Troubleshootingwhen upgrades go wrong

If your upgrade does not work as you had hoped, then there are a few things that you can check. First, look at your .htaccess file. Sometimes, WordPress MU does not correctly update this when changes are made. Usually, an error in your .htacces file will either lead to a 404 Page Not Found error, or a 500 Internal Server Error. If you suspect that your .htaccess file is the source of your problems, take a backup of it, and then rename htaccess.dist to .htaccess. In the .htaccess file, you can see a line that says this: RewriteBase BASE/

Edit the file so that the line simply reads like this:

RewriteBase /

The htaccess.dist file is distributed with the WordPress MU install and has all the default settings. If your .htaccess file is broken, then restoring this file will fix it. As our WordPress MU site has been installed to the root of our domain, we removed BASE so that the rewrite rules would point to the right URL.

Solving database connection issues

If you see an error like the one shown in the next screenshot, then this most likely means that there is a problem with your wpmu-config.php file.

If you get this error, the first thing you should check is the contents of your wpmu-config.php file. Make sure that the username and password provided are correct. Also, check that the server's hostname is correct. In most cases, it should say "localhost", but some web hosts such as GoDaddy do use remote MySQL servers. If those details are all correct, check that you can connect to the database using phpMyAdmin.

If you can't connect using phpMyAdmin, then it is likely that there is something wrong with MySQL on your server. If you're running a VPS, restart the MySQL. Depending on the OS of the server in question, we have two probable syntaxes. The first syntax is this:

service mysqld restart

The second possible syntax is as follows:

/etc/init.d/mysqld restart

If you aren't using a VPS or dedicated server, contact your web host to ask if they are aware of a problem on your server.

Diagnosing unusual error messages

If you see an error message instead of the blog, or in place of some of the content on the site, don't panic! Read the error message and take a look at the file that the error message belongs to.

For example, if the error message says:

Parse error: parse error in /var/www/slayers/wp-content/plugins/featured-posts.php on line 45

Load up that file, and scroll down to line 45. The chances are, the error will be right there or on one of the surrounding lines. Look for missing semicolons, unclosed brackets, and missing quotation marks.

Another error you may encounter involves "undefined functions". For example, see the following error:

Fatal error: Call to undefined function get_blog_posts() in /var/www/slayers/wp-content/ plugins/featured-posts.php on line 27

This error means PHP doesn't know anything about a function called get_blog_posts. This is because the function in wpmu-functions.php is actually called get_blog_post. In this case, the error was created when I was making some changes to the plugin. I was tidying up the code and I turned the function name into a plural by mistake. However, you could see this error appear if a function gets renamed or merged into another function as WordPress MU evolves.

Error Message: Headers already sent...

One common error message that can be difficult to track down is "Headers already sent". This error message means that the server has sent headers to the browser before WordPress MU was finished preparing them—usually because of something simple such as some white space in the wrong place. If you have edited any files recently, make sure that there is no white space before the opening <?php tag or the closing ?> tag. If you have just updated a plugin or updated WordPress MU itself, check the files that have been changed. Even a single space or line break in the wrong place can cause this error.

Was this article helpful?

0 0

Post a comment