当我的PHP脚本需要运行超过60秒时,我经常遇到504个网关错误.
我在专用服务器上的媒体寺庙.我已经联系了媒体寺,他们一直很有帮助,但他们的建议似乎都不适合我,我被告知要编辑这个文件.
/etc/httpd/conf.d/fcgid.conf
我必须在下面
LoadModule fcgid_module modules/mod_fcgid.so
AddHandler fcgid-script fcg fcgi fpl
FcgidIPCDir /var/run/mod_fcgid/sock
FcgidProcessTableFile /var/run/mod_fcgid/fcgid_shm
FcgidIdleTimeout 300
FcgidMaxRequestLen 1073741824
FcgidProcessLifeTime 10000
FcgidMaxProcesses 64
FcgidMaxProcessesPerClass 15
FcgidMinProcessesPerClass 0
FcgidConnectTimeout 600
FcgidioTimeout 600
FcgidInitialEnv RAILS_ENV production
FcgidIdleScanInterval 600
所以我尽可能多地尝试最大化,测试这个我只是运行下面的功能.
function test504(){
@set_time_limit(0);
sleep(60);
echo "true";
}
睡眠将在60秒以下的任何值上工作,返回true但在60上我得到504网关错误.
我的PHPinfo();输出
max_execution_time 600
max_input_time 180
我已经看到一些关于增加这个fastcgi_connect_timeout的帖子,但不知道在媒体寺庙的哪个地方找到它.
谁能帮忙谢谢
更新仍然无法修复此问题
不能罚款托管上的任何值.
client_header_timeout
client_body_timeout
send_timeout
fastcgi_read_timeout
我的Nginx.conf文件看起来像这样
#error_log /var/log/Nginx/error.log info;
#pid /var/run/Nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log /var/log/Nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 120;
#tcp_nodelay on;
#gzip on;
#gzip_disable "MSIE [1-6]\.(?!.*SV1)";
server_tokens off;
include /etc/Nginx/conf.d/*.conf;
}
这让我疯狂任何建议???
希望这有助于某人