PHP Application Error

I am running a PHP/MySQL CRM application on a virtual server and am getting an Internal Server 500 error when running the newsletter mailer. It seems to run about 6 minutes and processes about 200 emails before the error. It is using remote SMTP authentication to another server for the sender email. Increasing PHP limits in their php.ini file is having no effect and setting it to display errors does not show anything, I keep getting the 500 error. Can you think of any server settings that would cause this problem? I moved this account from our cPanel server and matched up the PHP settings.

Thanks.

Status: 
Closed (fixed)

Comments

Sounds like you are hitting the limit on how long a single PHP script can run.

You can increase this in Virtualmin at Server Configuration -> Website Options .. I'd suggest going with something like 5000 seconds.

That didn't make any change either. Still 6 minutes and a couple hundred emails.

Are there any settings that would limit remote SMTP connections? They are using SMTP authentication to a remote mail server. Or how about limits on outgoing emails?

Have you checked the logs/error_log file under the domain's home directory to see what is written when you get the 500 error?

Here's the last few lines, what does it tell you?

[Thu Mar 04 15:45:03 2010] [error] [client 64.34.169.238] Directory index forbidden by Options directive: /home/adler/public_html/ [Thu Mar 04 15:50:04 2010] [error] [client 64.34.169.238] Directory index forbidden by Options directive: /home/adler/public_html/ [Thu Mar 04 15:55:02 2010] [error] [client 64.34.169.238] Directory index forbidden by Options directive: /home/adler/public_html/ [Thu Mar 04 15:59:23 2010] [warn] mod_fcgid: read data timeout in 121 seconds [Thu Mar 04 15:59:23 2010] [error] [client 71.182.162.165] Premature end of script headers: index.php, referer: http://adlercrm.opensoftwarehost.com/iah2/index.php?module=EmailMan&acti... [Thu Mar 04 16:00:05 2010] [error] [client 64.34.169.238] Directory index forbidden by Options directive: /home/adler/public_html/

My programmer researched this and found a reference to an FCGid issue. I have copied the reference after this. We would need to figure out where to set the variable mentioned.

Another question, though. Do we need to run in this mode? I think in cPanel it is run in Apache mod_php mode. Why was FCGid mode selected when you installed Virtualmin/Webmin? I don't want to switch anything if you have a reason for running this way.

Thanks.

Long running scripts

Although the issue is not closely related to the actual installation of mod_fcgid, I don't have a better place for it now. You may experience some inexplicable "500 - Internal Server Error" pages when running perfectly fine scripts. In the Apache error log you find things like:

mod_fcgid: read data timeout in 20 seconds
[error] [client ip] Premature end of script headers: index.php, referer: ...
mod_fcgid: process <script>(pid) exit(communication error), get stop signal 15

This is because the script timeout (IPCCommTimeout) is set to 20 seconds by default. If your script does some more cpu-intensive computations or your server is under heavy load, this may be to short. Therefore, I suggest setting the mod_fcgid directives IPCConnectTimeout and IPCCommTimeout to 10/60 seconds.

Howdy -- the short answer is that you can indeed change the mode from fcgid to something else. A quick fix might be to give CGI a try. You can change the Virtual Server in question from fcgid to CGI by going into Server Configuration -> Website Options, and change the PHP Execution mode to "CGI".

While you could use mod_php, both fcgid and cgi provide an additional security benefit, since they utilize suexec to run scripts at the script owner, rather than as the Apache user.

Fcgid is faster than CGI, but for many applications, this is barely noticable :-) So you might consider giving that a try to see if it fits your needs.

Another alternative is that you could set IPCCommTimeout in the VirtualHost section for this particular domain in /etc/httpd/conf/httpd.conf. You could increase the timeout to whatever value you require.

My programmer researched this and found a reference to an FCGid issue. I have copied the reference after this. We would need to figure out where to set the variable mentioned.

Another question, though. Do we need to run in this mode? I think in cPanel it is run in Apache mod_php mode. Why was FCGid mode selected when you installed Virtualmin/Webmin? I don't want to switch anything if you have a reason for running this way.

Thanks.

Long running scripts

Although the issue is not closely related to the actual installation of mod_fcgid, I don't have a better place for it now. You may experience some inexplicable "500 - Internal Server Error" pages when running perfectly fine scripts. In the Apache error log you find things like:

mod_fcgid: read data timeout in 20 seconds [error] [client ip] Premature end of script headers: index.php, referer: ... mod_fcgid: process (pid) exit(communication error), get stop signal 15

This is because the script timeout (IPCCommTimeout) is set to 20 seconds by default. If your script does some more cpu-intensive computations or your server is under heavy load, this may be to short. Therefore, I suggest setting the mod_fcgid directives IPCConnectTimeout and IPCCommTimeout to 10/60 seconds.

Automatically closed -- issue fixed for 2 weeks with no activity.