Can't execute PHP script using PHP exec

后端 未结 6 1419
臣服心动
臣服心动 2020-11-30 03:42

I am trying to invoke a script which takes several seconds (web services with 3rd party) using the PHP exec call. After much struggling, I reduced this to the classic hello

6条回答
  •  旧巷少年郎
    2020-11-30 04:12

    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.

提交回复
热议问题