figo2476 Posted May 12, 2008 Share Posted May 12, 2008 Hi: Basically, run.php will do some stuff for PDF & it will run shell command lines by shell_exec() e.g. shell_exec("/var/www/vhosts/site.com/httpdocs/applications/home/utils/linux/pdf2image") I run: run.php in command line, then sh complains error: sh: /var/www/vhosts/site.com/httpdocs/applications/home/utils/linux/pdf2image: No such file or directory sh: /var/www/vhosts/site.com/httpdocs/applications/home/utils/extract/pdf2image: No such file or directory comments: It happens that I can run ./pdf2image inside the correct directory in shell. If I specify the full path in shell like /var/www/vhosts/site.com/httpdocs/applications/home/utils/linux/pdf2image, it will complain No such file or directory any hint? Link to comment https://forums.phpfreaks.com/topic/105200-run-php-in-linux-command-line/ Share on other sites More sharing options...
btherl Posted May 12, 2008 Share Posted May 12, 2008 What do these shell commands show: ls -l /var/www/vhosts/site.com/httpdocs/applications/home/utils/linux/pdf2image ls -l /var/www/vhosts/site.com/httpdocs/applications/home/utils/extract/pdf2image Link to comment https://forums.phpfreaks.com/topic/105200-run-php-in-linux-command-line/#findComment-538657 Share on other sites More sharing options...
DarkWater Posted May 12, 2008 Share Posted May 12, 2008 I'd do: ls -al /var/www/vhosts/site.com/httpdocs/applications/home/utils/linux ls -al /var/www/vhosts/site.com/httpdocs/applications/home/utils/extract =P Link to comment https://forums.phpfreaks.com/topic/105200-run-php-in-linux-command-line/#findComment-538660 Share on other sites More sharing options...
figo2476 Posted May 12, 2008 Author Share Posted May 12, 2008 Solved. Because one part of the file path will be changed dynamically, I need to hard code it. Thank for pointing out the idea. Link to comment https://forums.phpfreaks.com/topic/105200-run-php-in-linux-command-line/#findComment-538730 Share on other sites More sharing options...
trq Posted May 12, 2008 Share Posted May 12, 2008 The error is actually caused by you trying to execute a php script using sh. You need to put a shbang in your php file. #!/usr/bin/php Link to comment https://forums.phpfreaks.com/topic/105200-run-php-in-linux-command-line/#findComment-538735 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.