Linux Bash-PHP CLI error (path?)
I am running a PHP script on a Linux server from the command line as root. Using the exec("") command in PHP to execute some imagemagick stuff. ie exec("/usr/bin/tiff2ps -h 8.5 -w 11 /var/www/vhosts/mysite.com/pdf/*.tif");
If I do this exact command outside the PHP script (w/o php exec from bash), it works perfectly. But if I execute the PHP script from bash (root) I am getting the error "sh: /tiff2ps: No such file or directory" - I have checked and the file is there and it is chmod 777. Is this a path issue? Any ideas on how to fix? |
I ran into something like this once when writing a PHP script that must FTP certain files to another server at cron-determined intervals. Are you using absolute paths? You'll probably have to...
I. e. when developing the script I ran it in a browser, for testing and design. But, when I deployed it on the actual server, it simply didn't work. It turned out I had to specify all path & file references in absolute terms, i. e. /backupfiles/backupfile.tar.7z had to become /usr/www/fwuser/public_html/backupfiles/backupfile.tar.7z Only once I used these absolute paths, did the script run correctly when called by cron... So you might try using absolute paths in your exec() calls? |
All times are GMT -5. The time now is 03:48 PM. |