We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40447
    • 165 Posts
    Hi,

    I found this post of Bob about moving your modx site to a new server :

    Assuming that you've installed the exact same version of MODx on the new site, it's just a matter of going into PhpMyAdmin via cPanel on the old site and exporting the DB to an SQL file, then doing the same thing at the new site, but *importing* that SQL file (after creating the MODx DB and a user for it with full rights). To install, then, just edit the config.inc.php file to enter the DB name, user, and password and run the MODx install.

    Notice that in this post Bob writes two times about installing modx on the new server

    This is what I do when I move my modx site local from my laptop to a hosting server
    without installing modx on the hosting server :

    Local on your computer (laptop):
    1. Pack all folders and files in a zipfile, => yoursite.zip
    2. Export the local mysql database, => yoursite.sql
    3. Upload yoursite.zip to the www folder for your domain on the hosting server

    On your hosting server:
    4. Create a new and empty mysql database
    5. Unpack yoursite.zip in the www folder for your domain on the hosting server
    6. Edit the unpacked config.inc.php to match with the new data of the new created
    mysql database in step 4 as follows:

    $database_type = 'mysql';
    $database_server = 'yourdomain';
    $database_user = 'user';
    $database_password = 'password';
    $database_connection_charset = 'utf8';
    $database_connection_method = 'SET NAMES';
    $dbase = '`databasename`';
    $table_prefix = 'modx_';
    error_reporting(E_ALL & ~E_NOTICE);

    7. Import yoursite.sql into the new created mysql database on the hosting server
    8. Login with the manager using the same password as you were using Local
    and check that all relative paths are still working on the hosting server.


    So, this works for me without doing a new modx install on the hosting server but reading what Bob was writing in his post about installing modx on the hosting server, I am now wondering if my way of doing it is right or not ? And if not how come it is working without installing modx on the hosting server ? What is the big picture here ?
    Thanks in advance, Brian.
      • 3749
      • 24,544 Posts
      The only catch I see with your method is that MODX does a number of checks during the install. It adjusts settings and may issue warning messages about problems it finds. If the settings already exist (because they were set when you installed locally) MODX may not change them.


      If the server on your local install and the server on the remote are similar enough, your method will work, but it could fail for some people, especially when putting MODX in a subdirectory.


      ------------------------------------------------------------------------------------------
      PLEASE, PLEASE specify the version of MODX you are using.
      MODX info for everyone: http://bobsguides.com/modx.html
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 40447
        • 165 Posts
        Thanks Bob for replying on this.
        Ok so what I understand from you is that I should do a new modx install on the hosting server. This sounds of course more natural, but then the new mysql database on the hosting server will be filled with tables and data during the modx install on the server ! Isn't it so that the new mysql database on the hosting server must be empty, before you can import the local yoursite.sql file ? Else it will endup mixed with new and old data right ? And what about the new assets and manager folders created during the modx install on the server ? Can I delete them and replace them with the assets and manager folders from my modx on my local laptop ?
        Thanks in advance, Brian.
          • 3749
          • 24,544 Posts
          Actually, the "official" method is here: http://rtfm.modx.com/display/revolution20/Moving+Your+Site+to+a+New+Server.


          That's proven to be the most reliable way of doing things, but no method works perfectly for everyone. You could continue to use your method and add running Setup at the end of it.



          ------------------------------------------------------------------------------------------
          PLEASE, PLEASE specify the version of MODX you are using.
          MODX info for everyone: http://bobsguides.com/modx.html
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 40447
            • 165 Posts
            Hi,
            Thanks so far.
            I think it would help newbies if someone would post "a typical migration scenario". For example from xampp on a windows laptop to a hosting server. It is still not clear to me if the database on the hosting server must be empty or not before importing yoursite.sql that was exported on the laptop. My first thought about that is yes. That is the reason why I came up with my method but maybe I am wrong about that. Won't installing modx at the end overwrite anything if you already uploaded the assets and manager folders from your laptop ? What would be the way if you did first a new modx install on the server and not at the end ?

            Whenever changes are made to a MODX Revolution site in regards to installs, upgrades, or change of location it is important to re-run the domain.com/setup script. This should assist in solidifying the movement process due to the actions taken during its process.

            Is this the same as www.yourdomain.com/install/index.php ?

            Greetings Brian. [ed. note: sitecms last edited this post 14 years, 2 months ago.]
              • 3749
              • 24,544 Posts
              MODX will actually try to create an empty database for you on install, but sometimes it doesn't work and you have to create a new empty one yourself -- so, yes, it should be empty in the typical scenario.

              In Revolution, you go to yoursite.com/setup

              In Evolution, it's yoursite.com/install


              ------------------------------------------------------------------------------------------
              PLEASE, PLEASE specify the version of MODX you are using.
              MODX info for everyone: http://bobsguides.com/modx.html
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting