Update wordpress – WP Maintenance Mode – Internal Server Error – solution

The problem

After updating your WordPress and/or WP Maintenance Mode plugin your site is running normally for a period of time eg between 6 and 18 hours. Then at some random time all that any visitor is able to see is an Internal Server Error message. To anyone trying to get to your site, your site appears to be broken. For more information open the section on Server Side Errors in my article, Where to find Apache response codes and how to determine their meaning.

Internal server error, Update wordpress, WordPress, WP Maintenance Mode, Maintenance Mode, Maintenance, Mode, Internal Server Error, site, broken site, Plugins, Plugin, Support

Corrupt .htaccess file and Internal Server Error

Ok So you are working on your wordpress site. Making changes and updating your site when all of a sudden you get…

Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.
Apache/2.2.18 (Ubuntu) Server at www.yoursite.com Port 80

Before the panic sets in go to your .htaccess file and check that all is as it should be. For example when this happened to me last time this is what my file looked like.

Corrupt .htaccess

# BEGIN # BEGIN Wo<IfModul<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfM# END W
# END WordPress

notice the first and second last lines

# BEGIN # BEGIN Wo<IfModul<IfModule mod_rewrite.c>

</IfM# END W

well this means that during the last save your .htaccess file has become corrupt. There are a plethora of reasons why the .htaccess can become corrupt for example the .htaccess above was corrupted when my internet connection dropped out for a few seconds while the file was being written.

So how to fix this problem. You could try correcting the problem lines. If you know what the correct lines should look like. If you don’t know what the corrupted lines should look like you can delete the corrupted .htaccess file all together. Then in the wordpress dashboard open either a post or a page and save it, you don’t even need to make any changes and your .htaccess file will be re written. Simple huh?

How to Fix “mod_fcgid: HTTP request length 131619 (so far) exceeds MaxRequestLen (131072)” error on Ubuntu 12.04 LTS (Precise Pangolin) Linux.

If you are trying to upload a file through WordPress or another content system to your web site and your website is running on Apache2/PHP5/mod_fcgid, and your browser displays the error:

Browser error
Internal server error

and in your Apaches error log you see something like

Apaches error log
[Wed Nov 07 13:12:45 2012] [warn] [client 192.168.XXX.XXX] mod_fcgid: HTTP request length 131619 (so far) exceeds MaxRequestLen (131072), referer: …

This error is because the default value of FcgidMaxRequestLen is 131072 which is very small see Apache Module mod_fcgid for more information.

First check in your php.ini that upload_max_filesize has a big enough value for your upload. The default in php.ini is upload_max_filesize = 2M which stands for 2 megabytes (MB). If it is not set, set it to

Set php.ini
upload_max_filesize = 2M

Next edit your file /etc/apache2/mods-available/fcgid.conf, or if you have Virtualmin installed go to Webmin> Servers> Apache Webserver> and select the Global configuration tab then click Edit Config Files. Now select /etc/apache2/mods-available/fcgid.conf in the dropdown list then click the Edit Directives in File button. Either way you should see something like this.

Current directives
<IfModule mod_fcgid.c>
AddHandler    fcgid-script .fcgi
FcgidConnectTimeout 20
</IfModule>

You now want to add the FcgidMaxRequestLen 2097152 directive to make the file look like this. NOTE: FcgidMaxRequestLen 2097152 = 2MB.

Edit directive
<IfModule mod_fcgid.c>
AddHandler    fcgid-script .fcgi
FcgidConnectTimeout 20
FcgidMaxRequestLen 2097152
</IfModule>

Now save the changes and restart Apache with

Restart Apache
/etc/init.d/apache2 restart

Or if working in Virtualmin there is a Stop Apache link in the top right hand corner of your screen click it and when Apache has stoped the link will change to a Start Apache link. Click it also. And that is it you will now be able to upload your 2MB files.