You should copy your site to a subdomain and upgrade it there. That way you can test that everything works before copying the upgraded site back to make it live.
Prepare source MODX
Clear the cache and sessions via Manager
On your source installation, log into Manager then do the following:-
- Manage → Clear Cache
- Manage → Logout All Users
Clear the cache via SSH
SSH into your source webserver. Change directory to your source MODX install.
Some cache files will still be there, we want to remove them all. Be careful of this command.
$ rm -rf core*/cache/*
Dump the database
We want to have a safe copy of our database.
Make sure you have the database name, user and password. These details can be found in core*/config/config.inc.php.
Now dump the database, making sure you replace database_user and database_name with your database name and user name.
$ mysqldump -u database_user -p database_name > database_name.sql
Backup existing set-up
Plan for the worst!! So lets backup your current set-up.
Use tar to make a safe backup of your files, just in case!
$ tar -cvzf backup.tar.gz .
If for some reason you have files or folders that you want to exclude from the backup, you can use
$ tar -cvzf backup.tar.gz . --exclude='myfolder'
You can download this archive file using an ftp program like FileZilla.
Install latest MODX
Download latest version
Find the version of MODX you would like to upgrade to and download it directly onto your server. Make sure you replace the version below with your actual version.
$ wget https://modx.com/download/direct?id=modx-2.6.3-pl.zip --no-check-certificate --content-disposition
Unzip the file.
$ unzip modx-2.6.3-pl.zip
For ease of use, rename the extracted folder to something shorter, like modx.
$ mv modx-2.6.3-pl modx
Copy the newly downloaded version over your current one. If rsync is new to you, take a look at this useful article and consider using the
$ rsync -avP modx/connectors/ connectors*/ $ rsync -avP modx/core/ core*/ $ rsync -avP modx/manager/ manager*/ $ rsync -avP modx/setup/ setup/
Check config files
After doing any kind of update it is worth checking that your config files contain the correct settings.
$ nano core*/config/config.inc.php
The following is only necessary on older versions. On newer versions, these config files will be updated automatically when you re-run setup.
$ nano config.core.php $ nano connectors*/config.core.php $ nano manager*/config.core.php
Depending on how your server is configured, you may need to set the permissions of the setup directory
$ chmod -R 755 setup
Visit the setup url - yourdomain.com/setup
Follow the instructions, making sure you select Upgrade Existing Install
Once complete, log-in to the Manager to check that everything is working as it should.
Missing items in Manager
Sometimes items will be missing or unresponsive in the Manager. This can be because some js files are not running due to the wrong permissions. You can try the following
$ chmod 755 manager* $ chmod 755 manager*/index.php $ chmod 755 connectors* $ chmod 755 connectors*/index.php $ chmod 755 connectors*/modx.config.js.php $ chmod 755 connectors*/lang.js.php
Once working, remove the the unwanted files and directories that we created during this process.
$ rm modx-2.6.3-pl.zip $ rm backup.tar.gz $ rm database_name.sql $ rm -rf setup $ rm -rf modx
Hardening your MODX install
MODX, like all CMS's, could be exploited by unscrupulous individuals. Use this article to harden your MODX install.