Anuja D. Anuja D. - 3 months ago 20x
Bash Question

sh: php command not found error from web browser

I have one file with code

shell_exec (php test.php)

When I run this file from command prompt, It run successfully and when same file I am trying to run through web browser this will give error as

sh: php command not found.

what can be the issue?


Problem was with php path. so I have done like this

 if(defined('PHP_BINARY') && PHP_BINARY) 
    $path = PHP_BINARY . '/php'; //PHP >= 5.4
 else if(defined('PHP_BINDER') && PHP_BINDER)
    $path = PHP_BINDER . '/php'; //PHP < 5.4
    //Throws Exception 

and then used this variable in shell command as

   shell_exec ($path test.php)