PHP maximum execution time

耗尽温柔 提交于 2019-12-06 10:23:22

问题


In my Plesk 11, PHP 5.4.7. Apache/2.4.3 system, when I make cron jobs I get this error from error.log file.

[Tue Mar 19 21:33:18 2013] [warn] [client 88.44.55.66] mod_fcgid: read data timeout in 45 seconds
[Tue Mar 19 21:33:18 2013] [error] [client 88.44.55.66] Premature end of script headers: index.php

So I checked for execution time with this:

echo ini_get('max_execution_time');

I got this value: 1560000

It doesn't seem a timeout problem but I get timeout error?

Answer for the future reference:
Edit /etc/httpd/conf.d/fcgid.conf file with vim.
Change FcgidIOTimeout 45 to FcgidIOTimeout 600.
Restart Apache. Then Fast CGI timeout will be solved.


回答1:


That's a mod_fcgid timeout, not a PHP timeout. Take a look at the mod_fcgid documentation to find out how to change it, especially at FcgidIOTimeout.




回答2:


Cron scripts if build correctly should not be run through apache. Your error shows that you are running into a timeout set by mod_fcgi.




回答3:


If you access it through http in your cronjob, then it will work as a webpage request and then it may be affected by apache timeout because apache is involved in the process. You can run the php script directly with an absolute path using php interpreter to bypass apache



来源:https://stackoverflow.com/questions/15509104/php-maximum-execution-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!