note 37691 deleted from function.shell-exec by cmb
| From: | cmb@php.net | Date: | Sun, 07 Jul 2019 15:30:02 +0000 |
| Subject: | note 37691 deleted from function.shell-exec by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-211524@lists.php.net to get a copy of this message | ||
Note Submitter: ericphp at shepard dot com
----
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.