exec from php is causing an “Premature end of script headers: php-cgi.exe” error

前端 未结 2 578
借酒劲吻你
借酒劲吻你 2021-01-15 05:08

I have a php script written which calls an external command using exec which compiles a spacial database query result into a shape file. In tables with lots of records (say

2条回答
  •  广开言路
    2021-01-15 05:35

    Apparently, the default httpd.conf file included in Apache 2.4 doesn't automatically include the extra file httpd-default.conf under /conf/extra (probably by design), which includes the timeout parameter. Since the timeout parameter isn't defined, it reverts back to the default value of 30 seconds, and your script(s) time out.

    I did the following to resolve it:

    • Opened httpd.conf and added the following line to the bottom:

    Include conf/extra/httpd-default.conf

    • Restarted Apache, and it worked.

    An alternative would be to simply add the following line(s) to the httpd.conf file:

    Timeout 300
    KeepAlive On
    MaxKeepAliveRequests 100
    KeepAliveTimeout 5

    Hope this helps someone out there :)

提交回复
热议问题