• 500 Server Errors in WordPress when copying WordPress installs

    by  • November 15, 2009 • 500 Server error, subversion, Wordpress • 1 Comment

    Part of my workflow when developing WordPress based websites is to import a brand new WordPress install into Subversion, then check it out and develop on my local machine using an all in one LAMP stack such as XAMPP. Once I’m happy with the results I then copy it across to a staging production server, again using a SVN checkout. I’ve been using a great tutorial at http://mark-kirby.co.uk/2008/how-to-create-a-local-copy-of-a-wordpress-site/ to copy WordPress installs and it deals well with the issues concerning moving WordPress installs between local and remote servers, essentially boiling down to the following procedure:

    1. back up the existing WordPress database: Using phpmyadmin, select the original WP database in the left menu and click the ‘Export’ tab, then tick ‘Save as file’, choose either ‘zipped’ or ‘gzipped’ and click ‘Go’.
    2. create a new database on your staging site: Using phpmyadmin, select the ‘Privaliges’ tab, select ‘Create a new user’, fill in and take note of the fields as appropriate, select the option to ‘Create a database of the same name and grant all privaliges’, and click ‘Go’. Then modify two fields within the wp_options table; home and siteurl should point to your new URL.
    3. Import the backup of the existing WordPress database into the new database you just created, by selecting the newly created database on the left menu in phpmyadmin and clicking the ‘Import’ tab.
    4. copy the existing WordPress file structure as is into your staging area and update the database connection fields in wp-config.php; DB_NAME, DB_USER,DB_PASSWORD and DB_HOST should be altered to reflect the new user/table structure.

    If you now navigate to your new WordPress URL, you should see your blog homepage and I usually go straight into /wp-admin, regenerate permalinks (which regenerates .htaccess for the new URL) and reinstall any plugins that have cached the old URL (not many do this fortunately enough).

    Now I’ve done this many a time with great success, but recently I’d followed this procedure exactly (or thought I had) but this time got a 500 Server Error when trying to navigate to home page of the staging server WP install.

    Apache 500 Server Error

    After spending a little time searching for ‘WordPress 500 Server errors’ and checking through numerous log files I thought lets check /wp-admin, and got a helpful message:

    Wordpress wp-admin error message

    This highlighted the fact I’d correctly copied over the database but that there was something wrong with the WordPress database user permissions. So my lesson of the day: If you do get a 500 Server Error, first check /wp-admin, you may get a more useful error message!


    .NET developer at thetrainline.com, previously web developer at MRM Meteorite. Awarded a PhD in misbehaviour detection in wireless ad-hoc networks. A keen C# ASP.net developer bridging the gap with APIs and JavaScript frameworks, one web app at a time.


    One Response to 500 Server Errors in WordPress when copying WordPress installs

    1. January 15, 2010 at 12:22 am

      Man, that’s exactly what happened to me too. I’ve searched for an hour with no results.
      Thought it was something more complicated but it was as simple as manually changing the wp-config file.
      Did all sorts of things with the server before reaching your site :)


    Leave a Reply

    Your email address will not be published. Required fields are marked *