When I choose PHP-FPM running NextCloud on my ISPConfig install, I keep running into 504 Gateway errors. I have found in other posts that I need to increase the timeout, so I increased the timeout in php.ini options but no change. Running PHP FastCGI I don't have the timeout issue. I made the change to PHP-FPM since I was under the impression that it took less memory and ran a little faster. If that's not the case, I am fine with keeping FastCGI. But if it reduces the load or allows my sites to run better, then I would like to keep PHP-FPM. Is there a place I can adjust to fix this gateway timeout since the php.ini settings I tried did not resolve the problem? Or did I miss adding some other setting in the php.ini? PHP settings: max_execution_time=3600 max_input_time=3600 memory_limit=512M
That sounds like the web server timing out reading from php-fpm, not the php daemon timing out waiting for script output. For apache the are tunable settings (for mod_fcgid iirc), and probably similar settings for nginx I'd guess.
Ok, so new options in the apache section? Server is running apache. Can you give me an idea of what settings I should be looking for?
Can also be a configuration error for php-fpm (like installation missing?). Do you get any entries in your error.log file?
From a quick look at the documentation, it is most likely FcgidIOTimeout, though you can look over other options as well. @Steini86 has a good point, you should verify that a simple phpinfo() page works under php-fpm.
It only 504's during long-running operations. Normal pages load ok. And if I wait and then refresh the page, the long-running job is complete. So it still ran in the background.
My server already has that value configured: #Expand Upload Memory FcgidMaxRequestLen 268435456 #Adjust Server FcgidIdleTimeout 60 FcgidProcessLifeTime 120 FcgidMaxRequestsPerProcess 500 FcgidMaxProcesses 150 FcgidMaxProcessesPerClass 144 FcgidMinProcessesPerClass 0 FcgidConnectTimeout 30 FcgidIOTimeout 600 FcgidIdleScanInterval 10 FcgidMaxRequestLen 269484032 FcgidBusyTimeout 3600 FcgidProcessLifeTime 3600 FcgidOutputBufferSize 0
But 600 seconds or even 30 seconds are not going by. It dies in 10-15 seconds after the long process (like a backup) starts. And would these settings not affect the FastCGI side as well? Since that side works without a hitch, that does not sound right.
So increasing your timeout is not what you need. Check for errors in logs as already mentioned, and if you find nothing (and maybe verify php settings for your script have logging enabled), you could try attaching to the process with strace before it dies, and see what happens when it does. No, FastCGI mode uses mod_fastcgi.
First, ISPConfig does not matter for this question at all as ISPConfig has no influence on the speed of FastCGI vs. PHP-FPM. PHP-FPM is the successor of FastCGI, in my experience, it might manage resources a bit better, but you won't find much speed difference.
I made the following adjustments and have been testing for the last month. All appears to be working fine since making these adjustments. vi /etc/php-fpm.d/www.conf change value to request_terminate_timeout = 300s vi /etc/httpd/conf.d/fcgid.conf Add these lines #Adjust Server FcgidIdleTimeout 600 FcgidProcessLifeTime 600 FcgidMaxRequestsPerProcess 500 FcgidMaxProcesses 150 FcgidMaxProcessesPerClass 144 FcgidMinProcessesPerClass 0 FcgidConnectTimeout 600 FcgidIOTimeout 600 FcgidIdleScanInterval 10 FcgidMaxRequestLen 269484032 FcgidBusyTimeout 3600 FcgidProcessLifeTime 3600 FcgidOutputBufferSize 0 vi /etc/httpd/conf.modules.d/00-proxy_timeout.conf Add these lines Timeout 600 ProxyTimeout 600 systemctl restart httpd systemctl restart php-fpm These have been adjusted to my server needs and system specs.