Usually it happens after migration. When there is absolutely nothing that could possibly go wrong:
- You already moved all the content to the new server and adjusted the permissions
- You exported the database dump and imported it into the new database
- You verified username, password for the database and checked again wp-config.php for errors
- You even wrote a little test script to make sure
12345678<?php$testConnection = mysql_connect('localhost', '<db user>', '<db password>');if (!$testConnection) {die('Error: ' . mysql_error());}echo 'Database connection working!';mysql_close($testConnection);?>
and it works just fine
- You turned on all PHP display_error and WP_DEBUG and still got nothing explaining the problem. In fact you got no error messages at all.
But still you are getting this ugly error as on picture above. And nothing in the logs that could shed any light on the situation even though you have all possible debug messages turned on. There is absolutely no indication what could be wrong but you almost sure that it’s not related to the database in this case. The only strange details is that you have HTTP error code 500 along with additional error message.
As the measure of last resort you are looking into the database dump, trying to find any trace for the problem. In the table wp_options, there is the very first record with option_name siteurl. And it so happens that it points to the wrong URL.
1 |
INSERT INTO `wp_options` VALUES (1,'siteurl','http://dev.domain.com','yes') |
Rrrright. You were just moving your Wordpress site from DEV location to production, and your database dump contains DEV siteurl. Bingo! – that is exactly the reason for this cryptic error. All you need is manually edit SQL dump with your favorite text editor replacing old URL (which is located in siteurl record) with your current actual URL and import modified SQL dump again.
Ta-da! Your Wordpress site is now loading and it’s time to go disable WP_DEBUG in wp-config.php and display_errors in php.ini
0 Comments.