My hoster moved my site to a new server with a new directory structure thereby breaking the MODX install. I’ve tried to install a newer version (it was 2.2.12 and now I’m trying to install 2.4.0) but during the setup it says that three directories are missing.
The new location is /home/zozolala/public_html/ and setup says that location is fine.
The old location was /home/httpd/vhosts/zozolala.com/httpdocs/ and setup says it’s missing, which it is.
So I’ve replaced all references to the old location in both the files and the database. I even changed the preserved.php files of the packages. I also removed all cache files of both MODX and my webbrowser. But setup still manages to find and complain about the old and missing location. I must be overlooking something but I have no clue what it is. How can MODX complain about a location that is no longer referenced? How can I fix this?
Observed behavior
Environment
MODX 2.2.12 and a server running PHP 7.2.7 and MariaDB 10.1.38
I would also suggest that when upgrading you upgrade to each of the main version numbers and then the latest versions when you get to 2.6 and 2.7. (ie: 2.3, 2.4, 2.5, 2.6, 2.6.5, 2.7, 2.7.1) I seem to remember that there can be some problems if you miss any out, especially around 2.3 and 2.4.
You may be able to use Bob Ray’s excellent Upgrade MODX extra to make this process easier. I am not sure if you can use it as far back as 2.2, but Bobs notes may have further details on that. https://bobsguides.com/upgrade-modx-package.html
@chunkyrice you probably only need to hit 2.3 and then straight to 2.7.1 should work. There is a slight bug with some Extras installed that causes a couple db tables to not update correctly otherwise. Usually, this is not a problem, however and can be remedied by adding the two columns that got added at 2.3.
I managed to get one step further and followed your advice to install 2.3 first. I get a green light on all the tests, but when I press install I get to see an error 500. This baffles me. There’s nothing wrong with the server and the install check says everything’s fine, so why then do I get a server error?
In my experience install troubles are almost always to do with permissions on the files and folders. Your host might have changed them when moving your site. I think folders should be 755 and files 644, but please check for current info on that.
I would check that there is nothing in the .htaccess file, or any php.ini files that contains references to the old file paths.
You could also check the file and folder permissions for the site. Normally they should be 755 for folders and 644 for files. The /core/config.inc.php should be 400 when the site is working, but for purposes of upgrading you need it to be writable so it should also be 644. Check with you host though they may require different permissions.
I notice that in my previous reply I made an error. It should have read…
The locations of other folders are then defined in a configuration file within your core folder…
/core/config.inc.php
But from what you have said I think you worked that out yourself.
The server responds with “HTTP ERROR 500”, “The server cannot process this request at this time.”
It doesn’t add anything to the server log file, which is entirely empty.
There are no more refernces to old locations anywhere. I downloaded all the files to my desktop PC and did a file search, just to be sure.
All files are set to 644 and all folders to 755.
The error_log in the setup folder does contain some details:
[03-Apr-2019 22:36:13 Europe/Amsterdam] PHP Fatal error: Uncaught Error: Call to a member function checkPolicy() on null in /home/zozolala/public_html/core/model/modx/modx.class.php:1876
Stack trace:
#0 /home/zozolala/public_html/core/model/modx/processors/system/country/getlist.class.php(10): modX->hasPermission('countries')
#1 /home/zozolala/public_html/core/model/modx/modprocessor.class.php(161): modCountryGetListProcessor->checkPermissions()
#2 /home/zozolala/public_html/core/model/modx/modx.class.php(1699): modProcessor->run()
#3 /home/zozolala/public_html/setup/includes/upgrades/common/2.4-user-country-iso.php(9): modX->runProcessor('system/country/...')
#4 /home/zozolala/public_html/setup/includes/upgrades/mysql/2.4.0-pl.php(17): include('/home/zozolala/...')
#5 /home/zozolala/public_html/setup/includes/modinstallversion.class.php(87): include_once('/home/zozolala/...')
#6 /home/zozolala/public_html/setup/includes/runner/modinstallrunnerweb.class.php(33): modInstallVersion->install()
#7 /home/zozolala/public_html/setup/includes/runner/modinstallrunner.class. in /home/zozolala/public_html/core/model/modx/modx.class.php on line 1876
Line 1876 of modx.class.php contains a comment, but 4 lines later MODX seems to check whether I’m allowed access to the current context.
I hard-coded a TRUE and this time the installation worked.
The site is viewable again, but now I can’t access the manager.
I get the same Error 500 as previously.
This is what the error_log in the manager folder says:
[03-Apr-2019 22:47:23 Europe/Amsterdam] PHP Fatal error: Uncaught Error: Call to a member function setProperties() on null in /home/zozolala/public_html/core/model/modx/modmanagerresponse.class.php:191
Stack trace:
#0 /home/zozolala/public_html/core/model/modx/modmanagerresponse.class.php(73): modManagerResponse->instantiateController('SecurityLoginMa...', 'getInstance')
#1 /home/zozolala/public_html/core/model/modx/modmanagerrequest.class.php(186): modManagerResponse->outputContent(Array)
#2 /home/zozolala/public_html/core/model/modx/modmanagerrequest.class.php(134): modManagerRequest->prepareResponse()
#3 /home/zozolala/public_html/manager/index.php(75): modManagerRequest->handleRequest()
#4 {main}
thrown in /home/zozolala/public_html/core/model/modx/modmanagerresponse.class.php on line 191
I have no idea what the problem is or how to solve it. No doubt does it have to do with me hacking my way in. The hack has been reset, but this has had no effect.
Am I sinking deeper into the quagmire or close to a solution?
There are several others that result in the same message.
Did you clear the contents of the /core/cache folder? Given what the host has done it would be a good idea to do so. However, I would take a copy of it so you can put the contents back if you lose the whole site. At the moment your site is at least visible. Clearing the cache is going to be necessary but sometimes it is nice to be able to put the contents back while you work out what to do next.
One thing you can do is trick MODX into running the database migration again. In the manager, go to System > System Settings and find the settings_version setting. Set that value to an earlier release, like 2.2.12 if that’s what you came from. Then run the setup again.
@andytough
There were indeed a few permissions set the wrong way. Mostly folders with a 750 instead of a 755. That has been resolved.
@markh
There were some columns missing in the database. Using Bob’s instructions I resolved that problem as well.
After fixing these issues I decided to do another install. This time of version 2.4.0, the next in line. I was hoping that now those other issues were fixed, it might reset some of the stuff that was still preventing me from entering the manager. Unfortunately it didn’t work. The update proceeded succesfully without a hitch, but there’s still an error 500 when I try to access the manager. The error I previously mentioned (the one that takes place in the modmanagerresponse.class.php) keeps popping up in the error_log of the manager.
We have some pages in French and English (it’s a Dutch site) and we use Babel for that. It’s been a while since I actively used it, but I assume Babel has a country list. Could that interfere?