• My brain is full, having read all the great articles on how to move a WP site. I tried the move this morning but I got confused and couldn’t finish. I could use feedback on how I think this should work.

    The site is moving from one hosting account to another. I was on old host management technology, and migrated all my non-WP sites to a new cPanel hosting account. I think, in the language of the help articles, that meant I was moving to a new server. In addition, the domain changed.

    I created a local FTP copy of the old site (i.e. wp-admin, etc.), along with an export of the old MySQL file.

    Via cPanel, I installed WP on the new site location, deleted all the files/folders created by the install, and then FTP uploaded all the files/folders from the old site. I also imported the old MySQL file data into the new MySQL file.

    Went to the config file to update the MySQL connection and got confused finding the new host name (had the id and password OK).

    My assumption is, that when I figure out what the sql host name is, the changes to the config file will create the database connection. True?

    I think there is another step I need to do; getting the domain name updated. If true, is that done in the MySQL file?

    I want to get this process figured out since I expect to do other moves.

    • This topic was modified 8 years, 5 months ago by tdcarp.
Viewing 15 replies - 1 through 15 (of 25 total)
  • Pretty straight forward:

    1. Create the new domain on the new server (i.e. create the CPanel account)
    2. Copy the files into the /public_html (or whatever dir you’re using for root)
    3. Create a new database on new server and import MySQL file
    4. Edit /wp-config.php and change the DB_NAME, DB_USER & DB_PASS settings to the new db you just created
    5. Update the DNS and point the A Record and www CNAME record to the new server IP address.

    Done – that’s it (If you are using the exact same domain name and installing in the same root directory i.e if site was on https://www.domain.com/wp then make sure it’s the same on the new server)

    Thread Starter tdcarp

    (@tdcarp)

    Thanks Shannon

    If I understand, your approach does not install WP using cPanel on the new hosting account, but instead, WP gets installed by coping all the files and creating a new db. I’ll recreate the db and do the import again.

    Step 4 is where I got confused. I know the name, pass, and user, but the wp-config.php had a long host name that seemed to be from the old db.

    I’ll record the host name before and after the import to see if it changed.

    Please hang in a little bit longer while I get the process figured out.

    Thanks again!

    Thread Starter tdcarp

    (@tdcarp)

    Shannon

    Created a new MySQL db and imported export from old db (looked at the user table and it has the users from the old installation).

    Added dbName, user, pswd to config. Interestingly, the config file has a long host name, yet the config_sample shows that field as “localhost”. MyPHPAdmin says the host is “localhost” so I changed the host name to ‘localhost’.

    Tried to logon to WP and got this error:

    Warning: Cannot modify header information – headers already sent by (output started at /home/wizardclown/public_html/carpenter/gmvuac_wp/wp-content/themes/hashi/functions.php:627) in /home/wizardclown/public_html/carpenter/gmvuac_wp/wp-login.php on line 390

    Warning: Cannot modify header information – headers already sent by (output started at /home/wizardclown/public_html/carpenter/gmvuac_wp/wp-content/themes/hashi/functions.php:627) in /home/wizardclown/public_html/carpenter/gmvuac_wp/wp-login.php on line 403

    Thread Starter tdcarp

    (@tdcarp)

    Going back to assure there is no residual from installing WP via cPanel. It still showed WP installed. Will start the test again.

    Thread Starter tdcarp

    (@tdcarp)

    Completely removed wp install from hosting account. Made sure all files and db were gone. Ran the migration again (upload all files, create db, import db data from old site).

    Modified config file to connect to new db.

    Got the same message (hashi is the active theme).

    Not sure where the error is.

    Tom

    Usually MqSQL host is just ‘localhost’ unless otherwise specified – it should tell you the host when you create the database.
    You are correct – the files and the database IS WordPress – no need to install a WordPress instance prior.

    As for the error: check the file on the line specified:
    /home/wizardclown/public_html/carpenter/gmvuac_wp/wp-content/themes/hashi/functions.php:627

    Your functions file is trying to do something that it can’t on this server.

    Thread Starter tdcarp

    (@tdcarp)

    I didn’t do step 5 yet (e.g. DNS, A record, CNAME). Not all that familiar with the terminology.

    Are these done using cPanel?

    The domain name changed, as did the server.

    I’ll review some of the articles to see if they explain in a way I can follow.

    Line 627 of the function.php file is the last line in the file (and is blank). Looked at the 2 lines in login.php. Don’t totally understand, but the keywords “server” and “path” are in the area of the specific lines.

    Again, may be things needed in your step 5.

    Thanks for your continuing help.

    Thread Starter tdcarp

    (@tdcarp)

    Found the domain management in cPanel. See the A and CNAME records. I don’t see what should be changed.

    The 2 A records (@ and admin) both have the new server IP address. The CNAME www record is @.

    Does that help?

    Is it possible the MySQL export/import wasn’t right? In other words, I took all the defaults for the export except the DROP option, which appeared to be important from something I read.

    • This reply was modified 8 years, 5 months ago by tdcarp.
    Thread Starter tdcarp

    (@tdcarp)

    Browsed the database and found a couple records in the wp-options table that point to the old domain (option_name(s) siteurl and home).

    Do I edit? Was this avoidable (e.g. different options for export/import)? Almost feels like I could have made the change from within WP on the old site (after all the files are downloaded). The export would then have the domain/url for the new server.

    • This reply was modified 8 years, 5 months ago by tdcarp.

    You never mentioned that you were using a new domain?

    I assumed that you were just moving the site (domain included) to the new server. THe DNS is irrelevant then if you’re using a new domain.
    Also, yes, you need to go through and update all your URLs to the new domain
    In settings and also in each page

    Thread Starter tdcarp

    (@tdcarp)

    I’m so sorry I forgot to mention that in the original post. Big bad!

    I see where the options (settings) are. You say “each page”(?). Where’s that? I don’t see pages in the database, nor do I see any in the php files.

    For the specific migration I’m working on, the process seems to be:

    1. FTP the files (download to local; upload to new server)
    2. Change the settings for the domain
    3. Export/import the database (create a new db via cPanel)

    The config file should be right (i.e. have the new domain) because the change was made before the db export.

    OK?

    Thread Starter tdcarp

    (@tdcarp)

    Apparently, pages are stored in the posts table. I browsed a couple records and don’t see any domain references.

    Regardless, would all this be avoided if the domain were changed on the old site before the db export?

    Would that handle both the settings and the pages?

    If you are capable, confident and have a backup, you can try running this.

    NOTE: Make a backup.

    UPDATE wp_posts SET post_content = REPLACE(post_content, 'www.oldomain.com/wp/', 'www.newdomain.com/');

    • This reply was modified 8 years, 5 months ago by SJW.
    Thread Starter tdcarp

    (@tdcarp)

    Since I want this to be repeatable, I’m going to test this process:

    1. Migrate the files (using FTP, this will create a backup).
    2. Change the WP setting to the new domain.
    3. Export the database; create a new db; import the db data.
    4. Update the config file to create a new db connection.

    Will post back the results.

    Thread Starter tdcarp

    (@tdcarp)

    Things were in such a state that I decided to start all over re-creating the original wp site from scratch. Too many changes to config file, domain addons, db settings, etc. Not such a big deal since this is just a wp test area.

    Once recreated, I’ll run a migration test again using the method in my last post. For others’ benefit, I’ll post the result.

Viewing 15 replies - 1 through 15 (of 25 total)
  • The topic ‘Moving WP site to new server’ is closed to new replies.