mod_fcgid: HTTP request length exceeds MaxRequestLen

While running PHP as fastcgi (mod_fcgid) and you encountering 500 server errors as below whenver you upload larget attachments

mod_fcgid: HTTP request length 131600 (so far) exceeds MaxRequestLen (131072), referer:

From this error, the server is mod_fcgid enabled and the size of the request body exceeds amount limit set.

So below is the solution:

Solution 1: add the following code in a virtual host of affecting domain

<IfModule mod_fcgid.c>
MaxRequestLen 31457280
</IfModule>

MaxRequestLen size is set to 30MB

Solution 2: add link as below to /usr/local/apache/conf/php.conf

MaxRequestLen 31457280

MaxRequestLen 31457280

If your server do not have /usr/local/apache/conf/php.conf, then try to search if it have /usr/local/apache/conf/conf.d/mod_fcgid.conf. It was a same conf depend how your server install the module.

PHP-MySQL connection string

Using the Host

<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>

Using Hostname

<?php
// we connect to example.com and port 3307
$link = mysql_connect('example.com:3307', 'mysql_user', 'mysql_password');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);

// we connect to localhost at port 3307
$link = mysql_connect('127.0.0.1:3307', 'mysql_user', 'mysql_password');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>

Using Socket Path

<?php
// we connect to localhost and socket e.g. /tmp/mysql.sock

// variant 1: omit localhost
$link = mysql_connect(':/tmp/mysql', 'mysql_user', 'mysql_password');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);

// variant 2: with localhost
$link = mysql_connect('localhost:/tmp/mysql.sock', 'mysql_user', 'mysql_password');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>

Microsoft JET Database Engine error ‘80004005’

When you connect the asp page to the Access database, and it come out error as below

Microsoft JET Database Engine error ‘80004005’
Unspecified error

or

Could not create a Disk Cache Sub-directory for the Application

It might be the permission issue on the C:\Windows\Temp folder , that folder may need to assign Users and CREATOR OWNER ownership.

The funny thing is, it can not assign manually, you may need to run the command to do so. It may be some setting on it which I still do not sure what is the cause.

Anyways, just run the command as below by admin privilege on the command prompt.

icacls %SystemDrive%\Windows\Temp /grant Users:(CI)(S,WD,AD,X)

This command enables every user to create files and directories in the temporary directory.

icacls %SystemDrive%\Windows\Temp /grant "CREATOR OWNER":(OI)(CI)(IO)(F)

The user who creates a file or a directory in the temporary directory is the CREATOR OWNER. The CREATOR OWNER access control entry grants a user complete control over the file or over the directory. Other users cannot access these files and directories because they are not the CREATOR OWNER.

Running this 2 command, it will fix the permission issue on C:\Windows\Temp

TwentyEleven Sidebar on Single Posts

Some WordPress themes single posts do not include the side bar on single post. For the WordPress 2011 default themes TwentyEleven, it was one of it. Below is the 2 file need to edit to make the side bar appear in TwentyEleven single posts page.

(1) single.php

Add the link get_sidebar above of get_footer as below

<?php get_sidebar(); ?>
<?php get_footer(); ?>

(2) style.css

Add below css style in the css file

.singular #primary {
margin: 0 -26.4% 0 0;
}

#nav-single {
display: none;
}

.singular .entry-header .entry-meta {
position: relative;
}

.singular .hentry {
padding: 0;
}

.singular .entry-header, .singular .entry-content, .singular footer.entry-meta, .singular #comments-title {
width: 100%;
}

.singular #content, .left-sidebar.singular #content {
margin: 0 34% 0 7.6%;
}

.singular article .entry-title {
padding-top: 0;
}

.singular .entry-meta .edit-link a {
right: 0;
top: 0;
left: auto;
}

Edit MySQL timezone

For edit the time zone on your mysql server, you can run the query as below.

SET GLOBAL time_zone = 'timezone';

timezone can be set based on the zone you need. For example your time zone is GMT+0800, then just run the query as below.

SET GLOBAL time_zone = '+800';

For how to check the current time, please refer to here