Reputation: 2055
I have cloud hosting on Google, it sucks for to be honest but I am trying to get on with it, I installed LAMP stack on a VM and put my website in htdocs. When I try to access my site it gives me request timeout
but sometimes it works for 5 minute or so.
When I see apache error logs , it gives me this
075: Error dispatching request to : (polling)
[Tue Oct 27 18:12:55.185819 2015] [proxy_fcgi:error] [pid 4995:tid 140183521683200] (70007)The timeout specified has expired: [client 162.158.255.169:34198] AH01075: Error dispatching request to : (polling)
[Tue Oct 27 18:12:55.487458 2015] [core:notice] [pid 2953:tid 140183785137920] AH00052: child pid 4995 exit signal Segmentation fault (11)
[Tue Oct 27 18:12:55.787973 2015] [proxy_fcgi:error] [pid 5063:tid 140183530075904] (70007)The timeout specified has expired: [client 199.27.133.137:13151] AH01075: Error dispatching request to : (polling), referer: http://whichtube.com/watch/g9-4dCeFQng/allama-nasir-abbas-jawab-ali-as-nae-talwar-kayou-na-uthai.html
[Tue Oct 27 18:12:57.542883 2015] [proxy_fcgi:error] [pid 5329:tid 140183521683200] (70007)The timeout specified has expired: [client 173.245.56.198:51348] AH01075: Error dispatching request to : (polling)
[Tue Oct 27 18:12:57.976752 2015] [proxy_fcgi:error] [pid 5063:tid 140183479719680] (70007)The timeout specified has expired: [client 173.245.56.198:63779] AH01075: Error dispatching request to : (polling)
[Tue Oct 27 18:12:58.993666 2015] [proxy_fcgi:error] [pid 5194:tid 140183496505088] (70007)The timeout specified has expired: [client 162.158.255.141:16226] AH01075: Error dispatching request to : (polling)
[Tue Oct 27 18:12:59.196701 2015] [proxy_fcgi:error] [pid 5329:tid 140183513290496] (70007)The timeout specified has expired: [client 173.245.56.198:32819] AH01075: Error dispatching request to : (polling)
[Tue Oct 27 18:13:01.462039 2015] [proxy_fcgi:error] [pid 5329:tid 140183504897792] (70007)The timeout specified has expired: [client 199.27.128.166:48057] AH01075: Error dispatching request to : (polling)
[Tue Oct 27 18:13:07.518999 2015] [proxy_fcgi:error] [pid 5063:tid 140183471326976] (70007)The timeout specified has expired: [client 173.245.56.198:13694] AH01075: Error dispatching request to : (polling)
[Tue Oct 27 18:13:16.804990 2015] [proxy_fcgi:error] [pid 5261:tid 140183513290496] (70007)The timeout specified has expired: [client 199.27.128.134:28694] AH01075: Error dispatching request to : (polling)
[Tue Oct 27 18:13:33.055860 2015] [proxy_fcgi:error] [pid 5328:tid 140183236331264] (70007)The timeout specified has expired: [client 39.41.139.220:52154] AH01075: Error dispatching request to : (polling)
[Tue Oct 27 18:13:57.391361 2015] [proxy_fcgi:error] [pid 5063:tid 140183521683200] (70007)The timeout specified has expired: [client 39.41.139.220:52029] AH01075: Error dispatching request to : (polling)
[Tue Oct 27 18:13:57.552542 2015] [core:notice] [pid 2953:tid 140183785137920] AH00052: child pid 5063 exit signal Segmentation fault (11)
My website is in PHP, I haven't changed anything else other than directory permission, Is there something I am missing ?
Upvotes: 32
Views: 133957
Reputation: 8756
I had the same problem and in my case this solution worked:
request_terminate_timeout
value located in my
/etc/php-fpm.d/www.conf
file.Note: This option overrides php max_execution_time ini option and setting a low value for it could make you a lot of troubles because it will override other options and forcefully kill the request if the timeout expires. (If you ask which value to set; it should be max script processing time based on your needs but normally 600s(10minutes) or 10m(10minutes) is more than enough.)
Upvotes: 1
Reputation: 600
I faced this exact problem. I solved the problem by increasing timeout. My OS is AlmaLinux 8.5. Add the following two lines either in your httpd.conf
or your virtualhost
conf file.
Timeout 600
ProxyTimeout 600
Upvotes: 2
Reputation: 1
I had the same problem and in my case the solution posted by Roberto Ibarra worked.
I had the errors:
/var/log/php8.1-fpm.log
.......execution timed out (63.395915 sec), terminating
/var/log/apache2/sitenamexxxx_error_log
[Tue Mar 05 16:33:12.625599 2024] [proxy_fcgi:error] [pid 262376:tid 140090231719488] [client xx.xx.xx.xxxx:59735] AH01067: Failed to read FastCGI header, referer:
[Tue Mar 05 16:33:12.625645 2024] [proxy_fcgi:error] [pid 262376:tid 140090231719488] (104)Connection reset by peer: [client xx.xx.xx.xxxx:59735] AH01075: Error dispatching request to : , referer
I modified the file:
/etc/apache2/mods-enabled/reqtimeout.conf
RequestReadTimeout handshake=0 header=20-600,MinRate=500 body=20,MinRate=500
Restarted Apache and php8.1-fpm.
Upvotes: 0
Reputation: 2187
It appears that your PHP code is taking longer than the configured timeout to complete. When apache loads a PHP page using fcgi it sends the request of to PHP-FPM service to be processed. If PHP-FPM takes too long to respond then you will see this type of timeout. Possible causes are; your PHP code could be stuck in a loop, or waiting on a response from a database that is taking a particularly long time.
To troubleshoot I would use the CLI version of php to see if the script completes in a reasonable amount of time ($ time php /path/to/file.php). There may additional information in the PHP-FPM log (default: /var/log/php-fpm.log).
Upvotes: 10
Reputation: 1
I had the same problem on Centos 7 : problem with SELINUX.
You can temporary disable SELINUX to check :
sudo setenforce 0
Upvotes: -3
Reputation: 433
I was having the same problem, turns out Apache has module that handles timeouts called mod_reqtimeout
The default value (you won't see it in the default http.conf) is:
RequestReadTimeout handshake=0 header=20-40,MinRate=500 body=20,MinRate=500
In my case I was uploading a file through a plain HTML form submission, so the file is technically part of the header and the default configuration says that the header will timeout at 20 to 40 seconds. The 20-40 thing is pretty cool because it will timeout at 20 seconds but if 500 bytes are sent in a second, it will add an additional second of wait time until it reaches 40 seconds and then timeout no matter what.
I upload larger files in my website so I added this line to my httpd.conf file:
RequestReadTimeout handshake=0 header=20-600,MinRate=500 body=20,MinRate=500
So as long as my user is sending data at a minimum of 500 bytes/s, the request will not time out until a max. of 600 seconds is reached (better read the documentation, don't quote me on the throughput rate)
It's actually a pretty cool Apache module but not super well known as people recommend to change other apache timeout settings in other similar "The timeout specified has expired:" problems related to PHP-FPM but this problem happens with any post that takes more than 40 seconds to be submitted by default in Apache.
Upvotes: 21
Reputation: 79
For me a restart of php-fpm did the job. After looking in the log as @varlogtim adviced. The log showed that there was no activity for the last 12 hours...
Upvotes: 7
Reputation: 131
I had this problem, too. You may want to looking for a hard-code part and a connection to another unavailable server, in your code. (for example a local IP which is not accessible online).
For mine, I checked php-fpm.log on my server and I found my application is trying to connect to an old server (wrong IP) and it faces with timed out.
Upvotes: 2