SOLVED::Upgrade error: modx_core_path invalid

I’m struggling to upgrade a 2.7.1 site. I’ve tried upgrading to 2.7.3 and 2.8.0 but cant get beyond the first setup page:
ERROR: Your MODX_CORE_PATH is invalid; please specify the correct path in the field above and click Submit. The path has to contain a trailing slash.

Can anyone offer any suggestions to solve this?
Thanks in advance.

The path that is output in the text field seems to be wrong.
It’s unlikely that the MODX core directory is inside the folder /setup/includes/.

Did you try setting the value of the text field to the correct path?

Thanks for the quick response.
I have tried /home2/mywebsite/public_html/includes/core/
…and other permutations.
Should it point to the ‘setup’ directory?

No, it should point to the “core” directory of MODX. The directory that contains the bulk of the PHP code for MODX. Most likely located in the “public_html” folder.
(The code specifically tests if the files xpdo/xpdo.class.php and model/modx/modx.class.php exist in the specified folder.)

Yes that’s what I thought. I don’t know why it defaults to point to the setup directory.
I’ve now been able to upgrade to the latest version.
I did get an error on the next page after adding the correct ‘core’ path…
Deprecated*: Array and string offset access syntax with curly braces is deprecated in /home2/mywebsite/public_html/setup/includes/parser/modinstallsmarty.class.php on line *75

But changing the PHP down to 7.3 solved the above deprecation warning and i was then able to upgrade to 2.8.0 and change PHP back to 7.4.

Thanks for helping diagnose the problem :slight_smile:

1 Like

I have the same problem trying to upgrade from 2.8.4 to 2.8.5.
The suggested path is clearly ridiculous

Can anyone tell me where MODX_CORE_PATH is stored so that I can change it permanently or, if it change it here to /home/mysite/public_html/core/ will that fix the problem permanently.

Next step is 3.0 and I could do without any problems when I do that upgrade.

The variable is defined in the file config.core.php (in the webroot).

The value of this variable has to be set correctly for MODX to work. So if your website worked correctly before the upgrade, I have no clue why the value during the upgrade would suddenly be incorrect.

Thanks for the reply

This is my config.core.php


    • This file is managed by the installation process. Any modifications to it may get overwritten.*
    • Add customizations to the $config_options array in core/config/*

  • /
    define(‘MODX_CORE_PATH’, dirname(FILE) . ‘/core/’);
    define(‘MODX_CONFIG_KEY’, ‘config’);

That would seem to give the correct answer to the path. upgrademodx is clearly getting a path from somewhere but itsn’t here and I’m still mystified

This could be the issue here. The path is set to a relative path (dirname(__FILE__)) that may be different if executed in a different file.

Try replacing the value with the actual absolute path. (That’s at least what I see in the config.core.php files of all my MODX installations.)

Will give that a try although there is a warning at the top of the file saying that it will be updated when an install is run.

Still doesn’t explain the path that I see when running upgrademodx which is seriously peculiar

Can’t experiment again for a couple of day because I have to give the users due warning.

I did some testing and this seems to be a problem with the UpgradeMODX extra.

During the setup, the MODX core path is defined in the file setup/includes/config.core.php.
By default (during a manual upgrade), MODX_CORE_PATH is defined like this:

UpgradeMODX however changes the content of the file setup/includes/config.core.php before the setup runs. The content of the file config.core.php (in the webroot) gets copied to the file setup/includes/config.core.php (here in the code).

This works ok, if the core path in config.core.php is an absolute path, but creates a problem with dirname(__FILE__) (as the directory path now includes setup/includes/).

1 Like

Thanks for the thoughts however I don’t think that would be the whole answer. According to Bob Ray there are four such files in different directories I checked every one of them and they all read the same.

I solved my problem by changeing the path here
so that it pointed to the correct location.
It worked and we are now running 2.8.5.
Obviously I still have no idea where the strange path came from and unless Bob Ray responds I probably never will.

One silver lining from all this was that I discovered how brilliant our hosting provider is. Krystal take regular backups and make them available to users. When it crashed on my first failed attempt It took 48 seconds to do the restore,much quicker than a cPanel backup and restore.