"Website and PHP options"

5 posts / 0 new
Last post
#1 Mon, 11/24/2014 - 10:00
srmobile

"Website and PHP options"

I'm looking for more information on the following options for PHP script execution mode.

Apache mod_php (run as Apache's user) CGI wrapper (run as virtual server owner) FCGId (run as virtual server owner)

Since going from PHP 5.3 to 5.5, (CentOS 6.5 to 7) I've got a script (I really need) that crashes randomly. What I've noticed is that sometimes going from FCGId to Apache or CGI seems to help for a little while but ultimately there are problems.

In FCGI mode:

Server error log: [Wed Nov 19 06:53:18.480673 2014] [fcgid:warn] [pid 26936] (104)Connection reset by peer: [client IP] mod_fcgid: error reading data from FastCGI server, referer: https://SITE/index.php/admin/icecatimport/adminhtml_scan/ajaxall/key/d4c... [Wed Nov 19 06:53:18.480762 2014] [core:error] [pid 26936] [client IP] End of script output before headers: index.php, referer: https://SITE/index.php/admin/icecatimport/adminhtml_scan/ajaxall/key/d4c...

In CGI mode: [Mon Nov 24 10:25:25.608312 2014] [cgi:warn] [pid 16440] [client 207.96.171.156:61344] AH01220: Timeout waiting for output from CGI script /home/ncds/cgi-bin/php5.cgi, referer: https://www.mysite.com/index.php/admin/icecatimport/adminhtml_scan/ajaxa... [Mon Nov 24 10:25:25.608399 2014] [cgi:error] [pid 16440] [client 207.96.171.156:61344] Script timed out before returning headers: php5.cgi, referer: https://www.mysite.com/index.php/admin/icecatimport/adminhtml_scan/ajaxa... [Mon Nov 24 10:26:25.639697 2014] [cgi:warn] [pid 16440] [client 207.96.171.156:61344] AH01220: Timeout waiting for output from CGI script /home/my_site/cgi-bin/php5.cgi, referer: https://www.mysite.com/index.php/admin/icecatimport/adminhtml_scan/ajaxa...

I've looked for information on the web and everything basically says to configure FCGI but nothing about CGI or mod_php. I'm hoping that by changing modes I will gain some stability.

I don't know if for CGI what values I need to put in /home/my_site/cgi-bin/php5.cgi or if they go in my httpd.conf.

What I would like to know is, where can I configure the timeouts for Apache mod_php and CGI? What do the timeout values for max execution time and max input time (from FCGI) look like?

Mon, 11/24/2014 - 11:48
andreychek

Howdy,

Hmm, you may be seeing the same issue in both CGI and FCGID, the errors being displayed may simply be different.

On the old server, how long did that script take to complete? Does it usually take a long time, 30+ seconds?

Also, what about using using mod_php -- do you notice similar problems then?

-Eric

Tue, 11/25/2014 - 05:58
srmobile

Hi Eric,

The script would batch about 5000 items and would vary between 2 to 4 hours depending on the remote server and the amount of data being transferred.

Yes, I was seeing the same type of behavior with mod_php, but I got enough clues from it to figure out that it was timing out at around 20 seconds consistently.

I ended up adding set_time_limit = 36000 to my php.ini and this has resolved the issue for mod_php... But I'm not sure if this is the safest method, I did not have that in my previous php.ini and it was working fine.

My understanding is that fcgi is the best option because it is isolated where as mod_php is more vulnerable? Is there a set_time_limit equivalent for fcgi?

Thanks!

Tue, 11/25/2014 - 09:48
andreychek

Howdy,

Yeah, FCGID and CGI are both considered the more secure options... mod_php is only safe on a system where all the users are trusted.

To change the timeout, you can do that in Server Configuration -> Website Options. There you can set "Maximum PHP script run time".

-Eric

Tue, 11/25/2014 - 13:07
srmobile

Hi Eric,

Yes I've had that option set to unlimited, if I switch back to FCGID and CGI the script crashes.

What I need is the equivalent command / variable of "set_time_limit" for FCGID and/or CGI

Thanks!

Topic locked