MODX Community

Updating 2.6.5-pl to 2.7.1-pl gives PHP Parse error in config.inc.php

Hello, first time poster here.

So today i was doing a test-run to update my much loved 2.6.5 installation to 2.7.1 but it gave me some trouble.

2.6.5 is running flawless and like a charm, no a single error to find in the logs.

What i did on my development server (all form ssh bash):

  • backend: clear cache, logout all users
  • Full Backup of current Modx-installation.
  • Full Dump of the Database.
  • WGET modx-2.7.1-pl-advanced.zip
  • unzip and "cp -rf " core an setup to the appropriate locations. (did an extra .bak for ./core/config/config.inc.php)
  • run setup using chrome’s incognito-mode
  • specified the core-location
  • Upgrade Existing Install (no other ticks)
  • Next - everything’s fine and green.

Parse error: syntax error, unexpected ‘{’ in /var/www/web2048/html/core/config/config.inc.php on line 92

Line 92 Reads:

if (!defined('MODX_CACHE_DISABLED')) {
$modx_cache_disabled= {cache_disabled};
define('MODX_CACHE_DISABLED', $modx_cache_disabled);
}

so… before the line 92 was:

$modx_cache_disabled= false;

Any ideas?

Thank you in advance.

Looks like the configuration file got corrupted in the upgrade. That occasionally happens (potentially connected to going back a step in the installation causing some installation info to get lost) and has an issue on GitHub.

Simplest fix is to restore the configuration file (just core/config/config.inc.php) from the backup.

It can’t hurt to run the setup again after that, to make sure that upgraded correctly, but if the setup results were all green that probably isn’t necessary.

1 Like

hi mark, i already did that, i also did a full restore and used 2.7.0-pl but it’s always the same result. :thinking:

And you’re 100% sure you restored the right file? I see you used the advanced distro but the error message mentions /html/core/config/ which seems like a standard path, perhaps some directories got mixed up along the way in one of the config.core.php files or installation.

jup
/var/www/web2048/html/core/config/config.inc.php
Document Root is:
/var/www/web2048/html/webroot/

Do you think it helps if i disable “caching” in the manager system settings?

Disabling caching in the settings is something I never recommend. Emptying core/cache/ is safe to try though.

Error message hasn’t changed?

Ok, i did that.
rm -fr /var/www/web2048/html/core/cache/*
Error stays the same:
Parse error : syntax error, unexpected ‘{’ in /var/www/web2048/html/core/config/config.inc.php on line 92

It happens right when i hit “Install”… when i “tail -n10” the config.inc.php right before i hit “install”, it is still OK.

Before an edit, your post refered to an error with a path of web1190 rather than web2048, which would support my suspicion that there might be a path mix up going on?

you’re good, i sorry but it was just a typo… :confused:

at the moment i try to strip down the installations extras bit by bit… bur no change so far.

Seems that it has something to do with:
./html/webroot/setup/includes/upgrades/common/2.7-remove-cache-disabled.php

    <?php
    /**
     * Common upgrade script for removing cache_disabled System Setting
     *
     * @var modX $modx
     * @package setup
     */
    $modx->removeObject('modSystemSetting', array('key' => 'cache_disabled'));

I doubt that migration is the cause, but I would be interested to hear how you arrived at that conclusion.

All signs you’ve posted still point to the right config file not having been restored to a pre-corrupted state. What’s on line 92 of the config file mentioned? (*please be careful about not posting actual configuration.)

I’m sorry for the late reply, but i’m out of Office for the Weekend.

Line 92 before i hit “install” (original state of my backup):
$modx_cache_disabled= false;
Line 92 the very moment i hit “install”:
$modx_cache_disabled= {cache_disabled};

So i assume that at some point of the migration process, the replacement of the placeholder “{cache_disabled}” with the value “false”, what is actually the configured value in the systemsettings, fails and PHP throws the Parse error.

As a Sidenote: web1190 is another of about 10 different modx,joomla,contao and typo development installations on that server, but in the present case there is no path mixing or something like that, i can assure you that all the different installations are very well separated.

You might try setting the ‘settings_version’ System Setting back to an earlier version and “upgrading” to 2.7.1 with the UpgradeMODX extra. That will give you all new MODX files and will clear the cache during the upgrade.

1 Like

Hello Bob, and thank you for your EXTRA, it worked right away, even without the change to the “settings_version”.

Although I followed the upgrade instructions exactly and also studied the extended troubleshooting, I could not pull off the upgrade via ssh.
I must have overlooked something?
Anyway, many thanks to @markh and @bobray for helping me to solve the problem.

I’m glad you got it sorted. I don’t know why the ssh solution didn’t work for you, but TBH, I’ve never done it that way.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.