1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.2 How to transfer site over to new host?

Discussion in 'Installation, Upgrade, and Import Support' started by SniperBrob, Feb 28, 2014.

  1. SniperBrob

    SniperBrob Member

    So I bought a new server to host my website on, and I can't figure out how to get it to work right. I installed Apache2, PHP, and MySQL already, and I transferred my files on the old box to the new box and put the files in the same directory they are in on my old box. What else do I need to do to get this to work? I'm stumped.
  2. borbole

    borbole Well-Known Member

    You will need to transfer the database as well besides the forum files then update the database details to the config.php file to reflect those of the db in the new host.
  3. Brogan

    Brogan XenForo Moderator Staff Member


    How can I move my installation to a different domain or host?
    Backup the existing database and server files. Copy them to the new domain/server and update the library/config.php file with the new database details as required. It may be necessary to set permissions for the data and internal_data directories to world writeable (CHMOD 0777). Lastly, update the Board URL in the ACP -> Options -> Basic Board Information, if it has changed.
    Note that if you are moving to a different type of web server and have Friendly URLs enabled, you will need to make the appropriate changes. Refer to the Friendly URLs section of the XenForo Manual for more details.
    Note also that redirection will be required if the domain name changes, to ensure any existing links continue to work.
  4. jaymsgq

    jaymsgq Member

    In addition to comments from @Brogan & @borbole. You may need to lookup on how to transfer MySQL databases across servers. see how to do it here https://www.digitalocean.com/community/articles/how-to-migrate-a-mysql-database-between-two-servers
  5. SniperBrob

    SniperBrob Member

    @jaymsgq @Brogan @borbole
    I transferred all the files over, installed Apache2, PHP, MySQL, and PhpMyAdmin, and moved all the SQL databases. Then I did what Brogan said to do and updated the information (The information was actually the same though). When I go to my website it still tells me "An unexpected database error occurred. Please try again later." What am I doing wrong? Do I need to take down my old website for the new one to work? Do I need to restart some programs? Did I forget to do something?

    Thanks for the help in advance
  6. borbole

    borbole Well-Known Member

    Can you view the page source of your forum and copy/paste here the error?
  7. SniperBrob

    SniperBrob Member

    An unexpected database error occurred. Please try again later.
    <!-- Mysqli prepare error: Table 'xenforo.xf_data_registry' doesn't exist -->

    Going to restart MySQL... that might be the problem
    EDIT: Nope, still have the error even after restarting
  8. Brogan

    Brogan XenForo Moderator Staff Member

    Your backup/restore of the DB doesn't seem to have been successful.
  9. SniperBrob

    SniperBrob Member

    I see what I did wrong, I moved the sql tables to the wrong directory. I moved them to where they should be, now I have a different error:

    <!-- Mysqli prepare error: Can't find file: './xenforo/xf_data_registry.frm' (errno: 13) -->
  10. Brogan

    Brogan XenForo Moderator Staff Member

    How are you doing the DB backup?

    An export/import should be all that's required.
    It appears you are trying to copy the actual files.
  11. SniperBrob

    SniperBrob Member

    I am, and that's my problem right? I was trying to send the databases through mySQL itself, but everything I did gave me an error or no permissions, then when I fixed the problem I ran into another one.
  12. WCFA

    WCFA Active Member

    Did you update your NS numbers at your registrar for the domain ??
    It may be pointing at the old one. Just a thought.
  13. borbole

    borbole Well-Known Member

    Can you please post in details everything that you did step by step?

    You must move the forum files and db only btw.
  14. SniperBrob

    SniperBrob Member

    Here is exactly what I did:

    1.) Set up my new server box with Linux Ubuntu 3.10
    2.) Followed this guide to set up my webserver and MySQL (I followed this guide when I set up my server on the old box and it worked great)
    3.) I ran this command: "scp -r root@(old server):/var/www/ /var/www/" to move over all my xenforo files
    4.) I ran this command: "scp -r root@(old server):/var/lib/mysql /var/lib/mysql" to move over all the mysql databases.

    I skipped a few small things in between, but that's pretty much what I did
    jazz_aaf likes this.
  15. Tracy Perry

    Tracy Perry Well-Known Member

    The normally recommended way for the DB is to export it out via mysqldump
    mysqldump -u UserName -p databasename > path/exported.sql
    Where the databasename is the actual name of your XenForo database. Then you (if you aren't using phpmyadmin) have to create an empty database on the new server by that name (with the same user and permissions to use the DB) and then import it to the newly created DB.
    I'm not sure simply copying all the actual data in the mysql directory (in my case, it's in /var/lib/mysql) over will work.

    One of the easiest guides I've found on creating the actual DB from the command line is here.
  16. Brogan

    Brogan XenForo Moderator Staff Member

    A clever guy once told me...

    In MySQL, when all tables were MyISAM, it was actually possible to copy the data files between servers; there were 3 per table: .MYI, .MYD, and .FRM.

    InnoDB is different. There are multi configurations for InnoDB, but neither allow direct copying anyway, mostly due to the transactional nature of it.

    If you have "file per table" enabled for InnoDB, there will be an .IBD file, but you still can't copy it manually.
    Mike, Tracy Perry and Amaury like this.
  17. Joshua

    Joshua Active Member

    I assume this is still the preferred method for moving to a new server?
    rsync files and dump/restore database?
    Is there any benefit to starting with a clean XF install on the other side, or is that just additional, unnecessary work? I should mention I'm on 1.3
  18. rainmotorsports

    rainmotorsports Well-Known Member

    The manual uncleverly instructs users in a method to cold copy innodb files. I believe the issue really is achieving a clean shut down which just on the daily basis of running the server can be a nightmare much less a move. Thats also part of the reason for the logs, something went wrong welcome to recovery.

    No matter the database server, engine and format, if its shut down properly everything is in files that if copied to an exactly identical server will know no difference. Transactions, Locks, Foreign Key Pairs, its all in the files when the process is shut down. When the process starts back up again its loading from those files, copied to another machine nothing would be lost. But a misconfiguration on the new machine I imagine is the next nightmare but I am no expert.

    Being a gaming forum our recovery needs are not strict. I prefer to work from a 6 to 24 hour old backup then to actually recover a database to the live server. I will usually do a recovery anyways to find out if we have any missing registrations etc. But for a business or worse yet a site handling financial transactions your needs are much greater.

Share This Page