标签:php max request nginx timeout time 504 execution 502
502问题
-
php-fpm
修改项:
request_terminate_timeout
位置:
eg: /etc/php5/fpm2/pool.d/www.conf
; The timeout for serving a single request after which the worker process will ; be killed. This option should be used when the 'max_execution_time' ini option ; does not stop script execution for some reason. A value of '0' means 'off'. ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) ; Default Value: 0 request_terminate_timeout = 300s
这个注释说明了,request_terminate_timeout 适用于,当max_execution_time由于某种原因无法终止脚本的时候,会把这个php-fpm请求干掉。
再看看max_execution_time的注释:这设置了脚本被解析器中止之前允许的最大执行时间,默认是30s。看样子,我这个请求应该是被max_execution_time这个设置干掉了。
-
php.ini
修改项:
max_execution_time
位置:
eg: /etc/php5/fpm2/php.ini
; Maximum execution time of each script, in seconds ; http://php.net/max-execution-time ; Note: This directive is hardcoded to 0 for the CLI SAPI max_execution_time = 300
-
重启
service php5-fpm restart
总结:
web请求php执行时间受到2方面控制,一个是php.ini的max_execution_time(要注意的是sleep,http请求等待响应的时间是不算的,这里算的是真正的执行时间),另一个是php-fpm request_terminate_timeout 设置,这个算的是请求开始n秒。
504问题
处理项:
request_terminate_timeout
位置:
/etc/nginx/sites-enabled/default
-
重启
/usr/sbin/nginx -s reload
参考地址:
https://blog.csdn.net/loophome/article/details/78604986
https://blog.csdn.net/lifei15731208550/article/details/89056867
标签:php,max,request,nginx,timeout,time,504,execution,502 来源: https://www.cnblogs.com/wanghaokun/p/11313887.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。