We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 53071
    • 4 Posts
    Hey there! So I'm attempting to transfer a client's MODX website over to our servers but am having some odd difficulties.

    The client sent me the website in a zip file along with an export of the database.

    Here's a few details of the site:
    MODX:
    Revolution v2.2.14-pl

    Plugins:
    FormIt v2.2.0-pl
    Gallery v1.7.0-pl
    getResources v1.6.1-pl
    googlesitemap v2.0.2-rc1
    MIGX v2.8.1-pl
    TinyMCE v4.3.3-pl
    Wayfinder v2.3.3-pl

    Here are the first steps I took:

    • Unpackaged the website.
    • Imported the MySQL database.
    • Deleted all files and folders inside the core/cache folder.
    • Did a search and replace to the files to replace the "MODX core path" with the correct one. (Which resulted in 9 changes across 4 files: config.core.php, connectors/config.core.php, core/config/config.inc.php, and manager/config.core.php)
    • Copied the setup folder from the official Rev v2.2.14-pl download.
    • Ran the setup with the "Advanced Upgrade Install" option and the "Core package has been manually unpacked" and "Files are already in place" options checked.

    and that's where the first problem occurs. After I put in my new database credentials (which I know for sure are correct), and click "Test database server connection and view collations.", nothing happens. Upon checking out my browser console log, I notice there's a 500 (Internal Server Error) for setup/processors/connector.php.

    So next, I merge the following folders/files from the official Rev v2.2.14-pl download into the website:
    ht.access
    connectors/
    core/
    manager/
    setup/
    index.php

    I ran the setup again and got the same error. Upon looking at the files inside core/cache/logs I found this:
    [2016-12-12 09:31:55] (ERROR in xPDOConnection::connect @ /www/sites/athomedsm/core/xpdo/xpdo.class.php : 3054) SQLSTATE[HY000] [2002] No such file or directory
    [2016-12-12 09:31:55] (ERROR in xPDOConnection::connect @ /www/sites/athomedsm/core/xpdo/xpdo.class.php : 3054) SQLSTATE[HY000] [2002] No such file or directory
    [2016-12-12 09:31:55] (ERROR @ /setup/processors/connector.php) Error preparing statement for query: SELECT `modSystemSetting`.`key` AS `modSystemSetting_key`, `modSystemSetting`.`value` AS `modSystemSetting_value`, `modSystemSetting`.`xtype` AS `modSystemSetting_xtype`, `modSystemSetting`.`namespace` AS `modSystemSetting_namespace`, `modSystemSetting`.`area` AS `modSystemSetting_area`, `modSystemSetting`.`editedon` AS `modSystemSetting_editedon` FROM `modx_system_settings` AS `modSystemSetting` -
    [2016-12-12 09:31:55] (ERROR in xPDOConnection::connect @ /www/sites/athomedsm/core/xpdo/xpdo.class.php : 3054) SQLSTATE[HY000] [2002] No such file or directory
    [2016-12-12 09:31:55] (ERROR in xPDOConnection::connect @ /www/sites/athomedsm/core/xpdo/xpdo.class.php : 3054) SQLSTATE[HY000] [2002] No such file or directory
    [2016-12-12 09:31:55] (ERROR @ /setup/processors/connector.php) Error preparing statement for query: SELECT `modSystemSetting`.`key` AS `modSystemSetting_key`, `modSystemSetting`.`value` AS `modSystemSetting_value`, `modSystemSetting`.`xtype` AS `modSystemSetting_xtype`, `modSystemSetting`.`namespace` AS `modSystemSetting_namespace`, `modSystemSetting`.`area` AS `modSystemSetting_area`, `modSystemSetting`.`editedon` AS `modSystemSetting_editedon` FROM `modx_system_settings` AS `modSystemSetting` -
    [2016-12-12 09:31:55] (FATAL) Could not load core MODX configuration!

    So then I decided to go ahead and manually update the database credentials inside of core/config/config.inc.php and ran the setup again except for this time I used the "Upgrade Existing Install" option and it worked! I was presented with the following success message:

    Config file successfully written.

    Config file permissions successfully updated.

    So at this point I'm like "Sweet, I'm pretty much done", but then I visit the website in the browser and everything looks good besides that there are missing images. I log into the manager and notice that all of the missing images are used in the Gallery plugin. I checked to see if there was an update available for the plugin but find out that it's already on the latest version.

    There's no 404 errors in the console or anything, the URL strings are just missing from the code completely.

    So then I decide to go ahead and update the MODX Revolution version to 2.2.15-pl just to see if that fixes it. I clear the cache, merge the files and run the setup again with no problems and still have missing images.

    So I go ahead and upgrade to MODX Revolution v2.3.0-pl with the newly added "Disable CSS/JS Compression" option checked. Except this time I receive two errors:

    Error creating table for class modUserGroupSetting

    Error updating table for class modResource
    Array
    (
    [0] => 42000
    [1] => 1061
    [2] => Duplicate key name 'cache_refresh_idx'
    )

    Upon clicking the Retry button, I'm presented with the following errors:

    Notice: Trying to get property of non-object in /www/sites/athomedsm/core/xpdo/xpdo.class.php on line 340

    Warning: array_merge(): Argument #2 is not an array in /www/sites/athomedsm/core/xpdo/xpdo.class.php on line 340

    Fatal error: Class 'xPDODriver_' not found in /www/sites/athomedsm/core/xpdo/xpdo.class.php on line 1867

    I tried running the setup again, only to get a blank screen after clicking the Next button, so I take a look at the logs and find this:
    [2016-12-12 10:12:02] (ERROR @ /setup/index.php) Could not create table `modx_user_group_settings`
    SQL: CREATE TABLE `modx_user_group_settings` (`group` INTEGER unsigned NOT NULL DEFAULT '0', `key` VARCHAR(50) NOT NULL, `value` TEXT NULL, `xtype` VARCHAR(75) NOT NULL DEFAULT 'textfield', `namespace` VARCHAR(40) NOT NULL DEFAULT 'core', `area` VARCHAR(255) NOT NULL DEFAULT '', `editedon` TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`group`,`key`)) ENGINE=MyISAM
    ERROR: Array
    (
    [0] => 42000
    [1] => 1067
    [2] => Invalid default value for 'editedon'
    )

    [2016-12-12 10:12:02] (ERROR in xPDOManager_mysql::addIndex @ /www/sites/athomedsm/core/xpdo/om/mysql/xpdomanager.class.php : 329) Error adding index cache_refresh_idx to modResource: Array
    (
    [0] => 42000
    [1] => 1061
    [2] => Duplicate key name 'cache_refresh_idx'
    )

    So from what I gather from that error log is that the MySQL command failed for some reason, so I try running it myself manually:
    CREATE TABLE `modx_user_group_settings` (`group` INTEGER unsigned NOT NULL DEFAULT '0', `key` VARCHAR(50) NOT NULL, `value` TEXT NULL, `xtype` VARCHAR(75) NOT NULL DEFAULT 'textfield', `namespace` VARCHAR(40) NOT NULL DEFAULT 'core', `area` VARCHAR(255) NOT NULL DEFAULT '', `editedon` TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`group`,`key`))

    and the table 'modx_user_group_settings' is created!

    I clear the cache and try to run the setup again and get the blank screen. So I go and checkout core/config/config.inc.php and notice that all of my variables have been replaced with placekeepers:
    $database_type = '{database_type}';
    $database_server = '{database_server}';
    $database_user = '{database_user}';
    $database_password = '{database_password}';
    $database_connection_charset = '{database_connection_charset}';
    $dbase = '{dbase}';
    $table_prefix = '{table_prefix}';
    $database_dsn = '{database_dsn}';
    $config_options = {config_options};
    $driver_options = {driver_options};


    So that's weird. I replace the file with one I had backed up in version control, clear the cache, and run the setup again...Success! The setup ran without any errors or warnings.

    Now this time, the login for the manager looks a little funny to me:


    In fact, the whole manager looks funny:


    and the images are all still missing.

    So I'm not really sure what to do at this point...Any help would be greatly appreciated!
      • 3749
      • 24,544 Posts
      Clearing your browser cache and cookies and manually deleting all files in the core/cache directory may clear up the Manager.

      Make sure you have this tag (with the exclamation point) in the head section of all templates.

      <base href=[[!++site_url]] />


      Check the MODX error log (in core/cache/logs/error.log).

      Check the path on the filesystem media path if you can get there. Media -> Media Sources. Right click on the filesystem Media Source and select "Update Media Source". The basePath amd baseUrl properties are usually blank and both of the ..relative properties are set to "yes."

      If you can use Package Manager (Extras -> Installer), you may have some packages that need updating for the newer version of MODX.


      I don't use Gallery, so I'm guessing here: Check the properties of the Gallery plugin (and snippet if there is one). See if there are any hard-coded paths there or if there's a place to set the Media Source it uses. You may need to create a new Media Source that points to Gallery's image directory. Another thing to try would be to save the gallery images somewhere safe, then uninstall and reinstall Gallery.

        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
        • 53071
        • 4 Posts
        Hey BobRay! Thanks for the reply!

        So here's something you might find odd:

        I decided to go ahead and start over with the whole process, back to unpacking the zip file my client sent me. Then, before I even ran the setup or anything, I updated MODX Revolution from version 2.2.14-pl straight to version 2.5.2-pl. I ran into a weird PHP error when first running through the setup, but after trying it a second time, everything seemed to finish fine.

        And would you believe that the images came back?! I'm not really sure why or anything but it seemed to work!

        Now, my only problem is, my manager is missing the navigation bar at the top:


        I've tried deleting everything in the core/cache folder and clearing my browser cookies and cache. Also JS/CSS Compression is turned off. There are no errors coming up in core/cache/logs.

        Any ideas? Thank you!
          • 22840
          • 1,572 Posts
          Check the paths in the following files

          /config.core.php
          /connectors/config.core.php
          /manager/config.core.php

          Also did you go straight to 2.5.2, you might want to do 2.3 then 2.4 then 2.5 as there were some important database updates in those that can cause issues
            • 53071
            • 4 Posts
            Hey Paulp! Thanks for the reply!

            I've checked the paths and they are all set correctly.

            If you read my original post you can see that I tried updating MODX incremently without success. Upgrading straight to 2.5.2 was the most success I have gotten so far.
              • 3749
              • 24,544 Posts
              Interesting. You might want to check the DB for missing fields that could bite you down the road. See this: http://bobsguides.com/blog.html/2016/06/27/missing-db-fields-(unknown-column)/
                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
                • 53071
                • 4 Posts
                Not sure why this was marked an answered when my issue was never solved. If you look at my very first post you'll see that I tried to update the MODX version incrementally without success. If that's the way it needs to be done then this all just goes back to the problems in my first post.

                At this point we are considering just migrating the client's website over to Wordpress...
                  • 3749
                  • 24,544 Posts
                  Did you check for the missing fields in the DB (my post just above)?
                  Did you try:
                  re-running setup?
                  repairing all fields in the DB in PhpMyAdmin?

                  One more thought -- you have to manually delete all the files in the core/cache directory *after* you clear the browser cache and cookies. If you didn't do it that way, you'd need to clear the browser stuff again before clearing the cache.



                    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