0

I am currently trying to migrate a live Wordpress site to a local server to do development. I believe I have done most steps correct, but I am only getting a blank page. I am quite certain that this is a database issue, since the database created from a fresh install at the local server works fine, but a database containing the data from the live server is not. The server is an Ubuntu server and the LAMP stack is properly installed. Here is what I have (currently) done:

  1. Done a fresh Wordpress install. The site works fine, and the default (emtpy) database is named wp_test.
  2. Create a new database, named live_25_01_2015, and insert all data from the live server using mysqldump. The data are properly inserted.
  3. I used the interconnectit tool to replace all instances of www.mypage.no with localhost/var/www, which is the place Apache looks for files. This will break some plugins (that are not currently existing anyway), but the links to images and other things should be ok.
  4. Create a new MySQL user, named mysqlusr, and give all privileges to this user on both wp_test and live_25_01_2015.
  5. Edit wp-config.php so that mysqlusr and its password is inserted along with the database.
  6. Using the empty database wp_test now works fine, giving the default Wordpress site, but switching to live_25_01_2015 gives a blank page when navigating to the site. Therefore, I believe that this must be an issue with the database.

Other information that may or may not matter:

  1. The salts in wp-config.php are from the fresh Wordpress install, not from the live server.
  2. There are no plugins or no themes installed since I did a fresh install, so that cannot be the issue.
  3. In wp-config.php the language is set to Norwegian like this: define('WPLANG', 'nb_NO');, since the live server is a Norwegian one.
  4. The user mysqlusr can actually select data from both databases, so the privileges seems to be correct.
  5. Enabling WP_DEBUG does nothing. No error is printed to screen, nor are any error_log files created.
  6. Trying to echo something at the first line of wp-config.php does nothing.
  • What about the website URL? – sakibmoon Jan 25 '15 at 15:24
  • Forgot that one, I updated the post now. I changed the URLs from www.mysite.no to localhost/var/www at where Apache is set upm using the Interconnectit tool. Unfortunately this did not help either. Is localhost/var/www the proper URL for the local server? – Krøllebølle Jan 25 '15 at 15:44
  • No. localhost can be the proper URL. Better yet, you should set a virtual host. Here's how you can do it in Ubuntu based distro: digitalocean.com/community/tutorials/… – sakibmoon Jan 26 '15 at 5:59
0

From the looks of it, you should be changing the pre-existing urls from /www.mypage.no to /localhost

The /var/www is part of the file path normally (though i suppose you could potentially set the server up that way...), so more than likely wordpress thinks it is at /var/www relative to the web root instead of /.

Don't forget to also change the two urls in the options table.

  • I have now renamed everything to localhost only. For example, there are two rows in wp_options where the option_value are http://localhost. All the other links now also start with http://localhost without /var/www. This does not solve the problems, however. Going to 192.168.1.2/wp-login.php provides the login page with pure html. Login provides another blank page. Is there some way I can enable debugging when define('WP_DEBUG', true); does nothing? I also changed the file permissions to non-root just in case. – Krøllebølle Jan 26 '15 at 16:03
  • I also noticed that the fresh install database wp_test that works had http://192.168.1.2 in the wp_options table. Changing the values to this did nothing. – Krøllebølle Jan 26 '15 at 16:10
  • Very strange. If the one that worked had 192.168.1.2 then changing the two main options to that should get you going. Of course, the white screen means something is failing badly. Have you set WP_DEBUG to true in your wp_config.php file in case it is throwing an error that might provide more information? – Privateer Jan 26 '15 at 18:43
  • Yeah, WP_DEBUG is true. The following debug statements are currently in wp-config.php: define('WP_DEBUG', true); define('WP_DEBUG_LOG', true); define('WP_DEBUG_DISPLAY', true); @ini_set('display_error', 1); define('SCRIPT_DEBUG', true);. Nothing happens, however, which is quite frustrating. No errors, no debug.log file. As before, switching to the empty, default Wordpress database makes the default site appear. I guess I will have to try to move information over to that database, piece by piece to see where it fails. This is indeed very strange. – Krøllebølle Jan 26 '15 at 21:17
0

This turned out to be a series of inaccuracies on my part. I'll post all the stuff I ran into in case anyone else has similar issues. I think this is about what happened:

  1. Everything was set up correct initially, but I changed www.mysite.no to localhost/var/www instead of just localhost.
  2. Then I changed to a fresh installation of Wordpress with a working (empty) database. The real database did not work (as would be expected).
  3. I then updated the real database by switching localhost/var/www to just localhost. This did not work, however. At this point I had probably messed up something else. Also, it seems that the proper solution is to use the IP address of the server, at least in this case where I use the browser in another computer on the network.
  4. Then, I created a new test database with all the data and changed www.mysite.no to 192.168.1.2, which is the IP address of my local server, and copied the Wordpress files from the live server. This made the site work as expected. (As a side note I ran into some issues with "Failed to open stream: Permission denied". This was fixed by running sudo chmod -R 755 /var/www.)
  5. Now I had some trouble with permalinks (which is an entirely different issue). The .htaccess file was missing, so I copied it from the live server and re-saved the permalink settings at Admin --> Settings --> Permalinks. Then I switched AllowOverride None to AllowOverride All in /etc/apache2/sites-enabled/000-default and ran sudo service apache2 restart.

So this was a series of mistakes on my behalf. I am still a bit baffled that Wordpress does not provide any error messages when the error is in the database URLs, however. Hope this can be of use to others.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.