WordPress Fatal Error in wp-db.php on line 774

Wow, I just noticed that my blog is now full of WordPress fatal errors and how to fix it. I admit, I’m a certified WordPress junkie. Haha! This is my 78th blog post and my 12th WordPress error post. So… I’ll tag this one as WordPress and… I think just WordPress.

This error is clasified as 500 Internal Server Error. This simply means that the server is the main cause that’s why this error occurred. If you’re familiar with the Fatal error Allowed memory size of [RANDOM NUMBERS HERE] bytes exhausted (tried to allocate [ANOTHER RANDOM NUMBERS HERE] bytes) in /home/user/public_html/wp-includes/wp-db.php on line 774, then you’ll have an idea that the main cause of this error is your server’s memory allocation to the specific user.
Continue reading “WordPress Fatal Error in wp-db.php on line 774”

Whitelist an IP address in your server via SSH

One day, one of my blog readers can’t access my site. I wondered why and how come she can’t access it but I can. I also asked other readers, and they can. If this happens to you, just like what happened to me, maybe that specific user was blacklisted by your host.

In order for him or her to access your site again, you need to whitelist his or her IP. So the first thing that you should do is ask his IP address, then whitelist it in your server. To white list an IP address, you need to type the following command via SSH:
csf -a IP /etc/init.d/csf restart

Just replace the IP with the actual IP address. For example you want to white list 1.1.1.1, just type the command
csf -a 1.1.1.1 /etc/init.d/csf restart

To see the white listed IPs you could use the command,
grep IP /etc/csf/csf.allow

I think this is not applicable to all server. I’m using CentOS 5.0 with suPHP as my PHP handler. If your server configuration is different, ask you host first if your not familiar with SSH commands.

Change your PHP handler from mod_php (DSO) to suPHP

Finally, I decided to change my server’s PHP handler to suPHP from mod_php. It’s more secure and I can update my plugins and WordPress files automatically without annoying permission errors.

Here’s what my php config looks like after the update:


php.conf updated to:
# This file was automatically generated by the Cpanel PHP Configuration system
# If you wish to change the way PHP is being handled by Apache on your system,
# use the /usr/local/cpanel/bin/rebuild_phpconf script or the WHM interface.
#
# Manual edits of this file will be lost when Apache is updated.
# SuPHP configuration for PHP5
LoadModule suphp_module modules/mod_suphp.so
suPHP_Engine on
AddType application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml

    suPHP_AddHandler application/x-httpd-php5

# End of autogenerated PHP configuration.
Updating user configurable PHP settings.
[info] recursion depth is set to: 2
Restarting Apache

Now, I can update WordPress hassle free!

To change your php handler, you should have WHM root access. This is the only way I know. I think you can change it via SSH, but I haven’t tried it yet.

Once you’re logged in as root, just go to Service Configuration > Configure PHP and SuExec > Alter Configuration > PHP 5 Handler > Select suPHP.

Once you’ve selected suPHP, just click “Save New Configuration”.

That’s it!