note 37691 added to function.shell-exec
| From: | ericphp at shepard dot com | Date: | Sun, 23 Nov 2003 07:45:11 +0000 |
| Subject: | note 37691 added to function.shell-exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-60860@lists.php.net to get a copy of this message | ||
I had major problems getting sell_exec() to work from PHP. It was working fine via the Telnet
command line.
Turns out (for me anyway) it was a pathing problem. I'm set up on a VPS FreeBSD server the does
not (technically) have root access.
PHP needs to reference the FULL PATH to the app it's calling. But it gets more tricky than
that. There may be more than one full path on a server. For instance, on mine there is:
>find ~/ -name mysqldump (VPS non-root search method)
/usr/local/bin/mysqldump
/usr/home/myusername/usr/local/bin/mysqldump
/usr/home/myusername/usr/local/mysql-3.23.41/bin/mysqldump
/usr/home/myusername/usr/local/mysql-3.23.43/bin/mysqldump
Turns out (after 5 hours of hair pulling fun) that
/usr/home/myusername/usr/local/mysql-3.23.43/bin/mysqldump was the winner.
The same applies to using cURL and PHP via Cron. /usr/home/myusername/usr/local/curl-7.10.5/bin/curl
works for me there.
And tar wouldn't work until I dug up PHPTAR /usr/home/myusername/usr/local/bin/phptar. Never
new that existed ...
Good luck.
----
Manual Page -- http://www.php.net/manual/en/function.shell-exec.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+37691
Delete -- http://master.php.net/manage/user-notes.php?action=delete+37691&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+37691&report=yes
Search -- http://master.php.net/manage/user-notes.php