Fixing 500 Errors on Media Temple DV 3.5 Running FastCGI

I’ve gotten a lot of questions about 500 errors on Media Temple. I’m currently running a Media Temple DV 3.5 Extreme server with Magento. It’s been quite a process getting things tuned up, but I’ve got the performance to an acceptable level now. See for yourself… http://www.bcsports.com/. When I first switched to the FastCGI version of PHP, there were a few issues to deal with, the most important were the sporadic 500 errors that would pop up.

You know, it was odd, I thought I had everything running smoothly, but my client would call me and say “I’m getting a 500 error right now”. I’d hit the server myself and … no problems. Pages loaded fine. So I decided to load test the server with a service that hits the server from many locations around the world. Whamo… 500 errors popping up. I immediately switched back to mod_php and ran it that way for a while. It was much slower, but more reliable.

So after a while, I realized that I needed the performance of FastCGI to run Magento with a reasonable amount of speed. I spent some additional time looking into the source of the 500 errors, and through some tuning and testing, I believe I’ve got it nailed. It seems that the timeout settings were causing the CGI to die before PHP got a chance to respond. So, without further ado, below is the configuration that cured my server…

1. With your favorite text editor, edit /etc/httpd/conf.d/fcgid.conf to the following:

# added by psa-mod-fcgid-configurator
LoadModule fcgid_module /usr/lib/httpd/modules/mod_fcgid.so

<IfModule mod_fcgid.c>
  SocketPath /var/lib/httpd/fcgid/sock
</IfModule>

# added by psa-mod-fcgid-configurator
<IfModule mod_fcgid.c>
IdleTimeout 300
ProcessLifeTime 10000
MaxProcessCount 64
DefaultMaxClassProcessCount 15
IPCConnectTimeout 600
IPCCommTimeout 600
</IfModule>

2. Restart apache by running “/etc/init.d/httpd restart”

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
  • Twitter

Leave a Reply