user2429783
user2429783

Reputation: 1

exec cannot find the PHP file to execute

I am trying to call a PHP script from another PHP script using the shell_exec command. when I enter the same command in the shell using the same user, everything works as expected. However, when I call it in PHP I got the following output:

X-Powered-By: PHP/5.3.23
Content-type: text/html

My PHP call is:

shell_exec('php -f /home/site/public_html/script.php > /home/site/log.txt &');

I check server configuration. Safe Mode is off. shell_exec('whoami') is working without any problem.

Upvotes: 0

Views: 1348

Answers (1)

beiller
beiller

Reputation: 3135

try

shell_exec('/usr/bin/php -f /home/site/public_html/script.php > /home/site/log.txt &');

or type

whereis php

and use the path given.

Upvotes: 1

Related Questions