1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Migrating WP DB + Site to new server

Discussion in 'WordPress' started by Tarheel, Jun 15, 2013.

  1. #1
    Hello,

    I am trying to move a site from my friends server onto mine. I have a new site for him that I am going to put up, but want to get the old site on an extra URL that I have just in case we need to get some info from it.

    I dumped the DB from the old server. Found + replaced the old URL in the SQL document and replaced with the new URL. I installed all of the files from old domain onto the new one. Went into phpmyadmin on my new domain and imported the database. When I go to the site it doesn't load anything, but instead it downloads a file to my computer...this is what it reads:
    PHP Code:
    <?php /**
    * Front to the WordPress application. This file doesn't do anything, but loads
    * wp-blog-header.php which does and tells WordPress to load the theme.
    *
    * @package WordPress
    */

    /**
    * Tells WordPress to load the WordPress theme and output it.
    *
    * @var bool
    */
    define('WP_USE_THEMES', true);
    /** Loads the WordPress Environment and Template */ require('./wp-blog-header.php');

    Any idea why this is happening? I'm sure I missed a step or something. Thank you in advance for your help.
     
    Tarheel, Jun 15, 2013 IP
  2. Nigel Lew

    Nigel Lew Notable Member

    Messages:
    4,642
    Likes Received:
    405
    Best Answers:
    21
    Trophy Points:
    295
    #2
    You have to make sure you change the url in two places and make sure you have uploaded all the files. In the DB check page 2 for the "home" url. You may want to reset or rename the htaccess file as well. Sorta hard to tell without taking a look at it.

    Hope that helps,
    Nigel
     
    Nigel Lew, Jun 15, 2013 IP
  3. Tarheel

    Tarheel Member

    Messages:
    92
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    33
    #3
    Nigel,

    Thank you for the reply. I made sure to Find + Replace the old URL with the new URL throughout the entire document. I did find that the database was calling for the old public_html location...and I updated that as well. Still getting the same issue when I attempt to go to the website. I am transferring it from a root URL to a subdirectory on the new URL...but I figured as long as I replaced all of the old URL's with the new one it should work properly.
     
    Tarheel, Jun 15, 2013 IP
  4. Tarheel

    Tarheel Member

    Messages:
    92
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    33
    #4
    To make sure I did this properly:

    I downloaded all of the files via FTP from the old domain. I then uploaded those exact files into the new URL via FTP. I created a blank mysql database on the new domain....do I need to install WP on this new database? Or since I have all of the files from the old domain do I not need to install it? I uploaded the old database onto the new URL and my blank database through phpmyadmin. It said it uploaded correctly.

    I was just curious if I needed to install WP on the new blank database before importing the database via phpmyadmin. Thank you...I hope this makes sense. Trying to switch my friends site tonight, but I want to have access to the old site too.
     
    Tarheel, Jun 15, 2013 IP
  5. Nigel Lew

    Nigel Lew Notable Member

    Messages:
    4,642
    Likes Received:
    405
    Best Answers:
    21
    Trophy Points:
    295
    #5
    No you just have to import the database you exported into the new database, change the info in wp-config and change the 2 urls I mentioned.


    That or your server may be configured funny. That can happen if Apache is not configured to execute php.

    Nigel
     
    Nigel Lew, Jun 15, 2013 IP
  6. Tarheel

    Tarheel Member

    Messages:
    92
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    33
    #6
    Oh, so you don't really have to search + replace all of the URL's throughout the DB? Someone once told me to do that to be safe because the URL is scattered throughout the entire DB.
     
    Tarheel, Jun 15, 2013 IP
  7. Nigel Lew

    Nigel Lew Notable Member

    Messages:
    4,642
    Likes Received:
    405
    Best Answers:
    21
    Trophy Points:
    295
    #7
    No and that gets a bit messy as well. Change the url on the first database page in phpmyadmin and then go to page 2 of it and you will see home. Just do it from there and make sure wp-config has the right db info.

    N.
     
    Nigel Lew, Jun 15, 2013 IP
  8. Karolwf

    Karolwf Active Member

    Messages:
    112
    Likes Received:
    24
    Best Answers:
    1
    Trophy Points:
    70
    #8
    I think you should:
    1. create a new database.
    2.change wp-config info with new database name, user and password
    3.Upload WP old files with new wp-config ( and plugins, themes)
    4.Run set-up.
    5. Restore database.
    6.Change URL in PHPmyadmin.
    7. Login and enjoy.

    I did it a few times. Always worked.

    Best Regards
     
    Karolwf, Jun 15, 2013 IP
  9. Oxxus

    Oxxus Member

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #9
    There is a lot easier way to change the url in the database using search and replace tool - http://interconnectit.com/products/search-and-replace-for-wordpress-databases/ (detailed instructions and tool are at this link)
     
    Oxxus, Aug 8, 2013 IP
  10. pupul

    pupul Prominent Member

    Messages:
    1,737
    Likes Received:
    66
    Best Answers:
    2
    Trophy Points:
    340
    #10
    Add these two lines to the file functions.php in your theme, immediately after the initial "<?php" line.
    update_option('siteurl','http://example.com/blog');
    update_option('home','http://example.com/blog');
    PHP:
    This will work for sure, if you haven't messed with your database and files.
    I have done like this many times.
     
    pupul, Aug 8, 2013 IP