Can’t execute PHP script using PHP exec

I had this issue also and it turns out this is a bug in php (#11430). The fix is to use php-cli when calling another php script within a php script. So you can still use exec but rather than use php use php-cli when calling it in the browser:

exec("php-cli  somescript.php");

This worked for me.

Leave a Comment