How to Manage the "array_keys() [function.array-keys]:" Message

Photo by <a href=You don’t have to be a programmer to enjoy the myriad benefits and virtues of WordPress, but every once in a while you may try something seemingly innocuous only to discover that you are suddenly faced with some very programmer-like message.

Look at the bright side – there is usually an easy fix and you will be able to feel like an extreme coder for solving it!

The following message may appear after a WordPress update or, more often than not, from copy and pasting a code snippet from some blog directory into that ever powerful open space that is the Text widget.

Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/maindomain/public_html/mydomain/wp-includes/widgets.php on line 676

Although there is no easy explanation about what the cause of this problem might be (it can be a variety of issues), it likely has something to do with a funky piece of code that your database didn’t like.  The problem is your blog is very unhappy now and you just want to go back to the way things were before the problem started.

This is one of those cases where the objective is not to understand why, but rather how to get back to the way things were before the problem started.

First the bad news – you may lose any custom code you entered in your various widgets in the form of php, html and text.

The good news is that not all is lost: with a few simple steps you should be back up and running in no time.

Using your FTP client as discussed in my previous troubleshooting article

, navigate to your root folder of your WordPress installation and find the file called wp-config.php

Click to view/edit, or save it to your desktop and open it in Notepad or a proper code editor like Dreamweaver.

If you take a look, a few lines down you should see the following lines:

 
define('DB_CHARSET', 'utf8'); define('DB_COLLATE', '');

What you want to do is to remove (“REM”) these statements out by adding a pair of slashes in front of each line so it looks like this:

// define('DB_CHARSET', 'utf8');
// define('DB_COLLATE', '');

Save the file and upload it (overwrite) to your root folder where you found it.

Now log back into your WordPress site and open up any text or php widgets and copy the code therein to your Notepad so that you can add them back in later.  If you know what code caused the problem, avoid putting this back in after this fix.  That is bad code.  Bad.  It will sleep in the dog house tonight.

Now remove those plugins and save your widget sidebar.

Things should go more or less back to normal.

Now go back to the file you edited on your desktop and remove the slashes you added in front of the two lines you found in the wp-config.php file.

Save and reupload (overwrite) the file back to your root directory on the server.

Now you can go back and recreate the custom text widgets, copying and inserting the code you have waiting for you in your Notepad.

For further notes on this issue see the following support forum at WordPress.

Photo by Evil Erin

How to Fix the WordPress "Fatal Error: Allowed memory size" Error

This frightening message can happen after a fresh installation or update of your WordPress blog. Although understanding the issue itself may be a bit advanced for the scope of this article, the fix is easy, even for those not well versed in MySQL, php or even just the stuff going on under the hood of a WordPress installation.

The message will look like this

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 143 bytes) in /home/your-directory-path…

In order to fix this, you will need to access your WordPress files by way of an ftp client. I like Filezilla , a free download, but any ftp client will do.

Once you are in your public_html directory, navigate to the folder that contains your WordPress installation and look for a file called wp-settings.php. Download that file to your desktop and open it in Notepad. Scanning down a few lines you will see something that reads:

if ( !defined('WP_MEMORY_LIMIT') )
define('WP_MEMORY_LIMIT', '32M');

You simply change the 32 to 64M which will give tell your server to allot more headroom for doing what it has to do. Save the file (do not rename it, and make sure you did this in Notepad or a proper code editor like Morphon or Dreamweaver; Wordpad might append a .txt extension which you don’t want.)

Now drag and drop the saved version of your updated file back into the directory on the server where you found it. You will be asked whether you want to overwrite the file. Say yes.

Presto, So long as you followed the above instructions carefully, your problem is solved.Godsend ipod

The Acid House