I found answer on my posting on the nginx forum - http://forum.nginx.org/read.php?2,127854
The answer, in my case, is to set:
request_terminate_timeout=30s
in php-fpm config (usually /etc/php5/fpm/php-fpm.conf
)
Note, you can use values other than 30s also.
I used it to match my value in main php.ini
file which is:
max_execution_time = 30
Thanks All. :-)
In your Apache virtualhost directive, you configure a php5 handler,
AddHandler fcgid-script .php
FCGIWrapper /usr/lib/cgi-bin/php5 .php
Options ExecCGI
In that instance, the FCGIWrapper entry is the php5 cgi binary. Other examples suggest creating your own script and calling that, having that script set options and in turn calling php.
For example,
FCGIWrapper /usr/local/bin/php .php
If you go with a wrapper script you can set options in that, if you don't (i.e. the first example), then you can set options directly in the Apache config files,
<IfModule mod_fcgid.c>
AddHandler fcgid-script .fcgi
FcgidConnectTimeout 20
FcgidIOTimeout 60
FcgidMaxRequestsPerProcess 400
FcgidIdleTimeout 60
FcgidMinProcessesPerClass 0
</IfModule>
That's pretty much it for a basic FastCGI config, some of it varies by distribution or if it's self compiled, but the above is the basic necessary stuff.
There appears to be quite an extensive FAQ on something very similar to your query here,
Apache + Chroot + FastCGI + PHP FAQ - http://www.seaoffire.net/fcgi-faq.html
Best Answer
mod_proxy_fcgi
, which is newly available in Apache 2.4, is just for this type of use case. The Apache wiki entry for PHP-FPM has some good guidance to get started.The
mod_proxy_fcgi
documentation also includes specific examples for setting up PHP-FPM and the PHP documentation also has helpful information.On the other hand,
mod_fastcgi
is notoriously difficult to set up and a memory hog. Additionally,mod_fcgi
doesn’t support spawned CGI servers. Because PHP-FPM is managed by itself, not by Apache,mod_fcgi
isn’t the best choice.