I've inherited the sysadmin role on a server that's running a wordpress website on top of Apache 2.4/Debian. It almost works, but it is issuing "500 internal server error" from time to time. In my error.log file I see:
End of script output before headers: php5, referer: http://www.xxxxxxx.xxx/wp-admin/post-new.php
I think the server is running mod_fcgid system wide, since I have
/etc/apache2/conf-enabled/fcgid.conf
with the following contents:
<Location />
AddHandler fcgid-script .php
Options +ExecCGI +FollowSymLinks
FcgidWrapper /usr/bin/php-cgi .php
</Location>
<Files ~ (\.php)>
AddHandler fcgid-script .php
FCGIWrapper /usr/lib/cgi-bin/php5 .php
Options ExecCGI FollowSymLinks
allow from all
</Files>
and I've found other questions, here and here, that are about the same error I get and that cite some mod_fcgid misconfiguration as the possible cause (wrong values in PHP_FCGI_CHILDREN and PHP_FCGI_MAX_REQUESTS variables). A reply in this forum also suggests a fcgid misconfiguration and seems to give more details about the problem (a possible bottleneck in number of accepted threads/connections), but it lacks a step-by-step explanation of what to do.
I'm no mod_fcgid expert. Can you help me understand where and how I should set the correct values for PHP_FCGI_CHILDREN and PHP_FCGI_MAX_REQUESTS variables?
You can add FCGI directive in the Apache pre_virtualhost_global.conf or the .htaccess file for the wordpress install, or in the vhost for the domain itself.