mod_proxy_fcgi configuration and settings

Greg M

Well-Known Member
May 26, 2016
50
16
58
Glasgow, Scotland
cPanel Access Level
Root Administrator
Hey,

So I'm using cPanel v60, with PHP7, mod_proxy_fcgi and PHP-FPM. all set up via WHM's GUI etc, so all the file paths etc are standard now.

Problem is that I have had to increase my PHP max execution time, however I keep getting the following error message from fcgi:

[proxy_fcgi:error] [pid #####:tid #############] (70007)The timeout specified has expired: [client xxx.xxx.xxx.xxx:6529] AH01075: Error dispatching request to : (polling), referer: https://domain.com/the_script_that_needs_more_time/

After researching I have found that fcgi has its own timeout setting (which is not noted anywhere in WHM for some silly reason)

I have been searching extensively but I cannot find the correct settings to increase the timeout for this. I am fairly certain I need to add it under Home »Service Configuration »Apache Configuration »Include Editor then add it to Pre VirtualHost include. HOWEVER I cannot find the correct <ifmodule xxxx> statement or the actual values. What I keep finding is results like this -> <IfModule mod_fcgid.c> obviously this wont work as I'm using mod_proxy_fcgi not mod_fcgid

so could someone please advise exactly what I need to add in order to stop fcgi doing this.

Thanks
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463

Greg M

Well-Known Member
May 26, 2016
50
16
58
Glasgow, Scotland
cPanel Access Level
Root Administrator
Hi Michael,

thank you for the reply, I had already corrected this and forgot to post that I fixed it, I have added 2 things which has got it working for me at the moment.

(replace ## with correct numbers for your set up)

first thing is under here:
/opt/cpanel/ea-php##/root/etc/php-fpm.d/domain.com.conf

and added request_terminate_timeout = ##s - remember the unit (s)


The second change I made was a virtual host include via WHM GUI

Home »Service Configuration »Apache Configuration »Include Editor » Pre VirtualHost Include

(I chose all versions of apache)

Then just add in this:

<IfModule proxy_fcgi_module>
timeout ##
</IfModule>



Im not sure if the second one was needed but they are both working for me.

This is definitely something that should be added to the UI if its not going to adhere to a users predefined time out settings in apache and PHP. I know its a slightly different configuration but I would imagine most users would want it set to their default time outs. It does seem to default to 60s so most people wont notice but in my case where you have a slow upload to an external server and its taking ages, fcgi closes the connection even though PHP and apache are still waiting for it to continue
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
Hello,

This feature is currently limited to the following options in the WHM UI:

Max Children
Process Idle Timeout
Max Requests

I encourage you to open a feature request if you'd like to see additional options added to the "Pool Options" feature under "PHP-FPM" in "WHM Home » Software » MultiPHP Manager":

Submit A Feature Request

Thank you.
 

sterling

Registered
Oct 23, 2006
1
1
150
Greg M's info helped, but I still got the timeout error. For some reason, the settings in Include Editor didn't work for me.

However, it worked when I created include conf file, then rebuilt conf & restarted apache via scripts.

/etc/apache2/conf.d/userdata/ssl/2_4/[username]/php-fpm.conf

TimeOut 600
ProxyTimeout 600
 
  • Like
Reactions: garconcn