Skip to main content
  1. All Posts/


Tools Open Source PHP WordPress
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
Copyright (C) 2011 Southwest Cyberport

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <>.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 


Moving a WordPress site to a new host or changing its domain can 
be a huge PITA.  This is because WP itself (as well as many plugins)
store the filesystem location and current URL of the WordPress site 
in the database.  So, simply copying your files and database may
unexpectedly break things.

Given the old and new URL's or filesystem paths, this tool updates a 
Wordpress MySQL database (it just updates wp_options and wp_posts -
seems to be the only places this is stored). 

Most importantly, it takes care to preserve serialized PHP arrays,
as many plugins now store their information in this manner.  Just doing
a SQL string REPLACE() call - as was the old way to do this - will 
"break" serialized PHP arrays in almost all cases.


Run it through Apache (recommended) by copying this folder to an Apache 
server that has access to your WordPress MySQL database.  
Running ./ should fix up permissions for most folks if needed.

You may also run it from the command line:
    php move-wordpress-cli.php

which may be preferable for large databases.

You may need to increase the 'max_execution_time = x' value in your php.ini 
if this script times out.

To run in debug mode, change the return value of debug() to "true" in


Make sure you have a back up of your database.
This tool does not check for SQL injection. 
Restrict web access to this directory or remove it after use.