Version française: Passer son CMS à une version plus récente de php

This document aims at guiding you through the steps needed to change the PHP version used by your website.

It is very similar from one CMS to another. Please note that the scope of this documentation is to cover only the most commonly used ones:

You'll also find links to the official SPIP documentation in the External resources section.

Keep in mind that modifying the PHP version doesn't directly affect your website content (files / databases), and can be reverted at any time in case changing it causes any problem.

If you're confident your website will properly work using the PHP version you aimed at, you can directly go to the "Change PHP version" section. You can also check our FAQ "How to change the PHP version of a sub-domain".

Note that any custom themes, modules, or plugins may have different compatibilities.

Summary

To be able to follow this procedure, you must be able to log into your hosting account. If you forgot your password, you can request a new password from the log in page.

Regardless of the CMS used, the steps are overall the same:

  1. Check your CMS current version
  2. Check the compatibility between your CMS and a newer PHP version
  3. Make a full backup (files and databases)
  4. Upgrade your CMS (if needed)
  5. Change the PHP version
  6. Check that your website is working properly

If you're unsure about a step, or have questions, you can contact our help-desk at any time to get support.

If an upgrade is needed and you don't want to do it yourself, our web development team may be able to help - depending on the needed skills and availability - and could prepare a quote to take care of it for you. Please keep in mind that the work calendar of the web team is quite full, so we recommend that you get in touch with us at your earliest convenience.

Check CMS current version

In most cases, the current version is displayed on your CMS's admin panel, or in the configuration file of your website.

WordPress

Drupal

Joomla

NextCloud

MediaWiki

There are different ways to check the MediaWiki version, depending on the currently used version:

Check compatibility between a CMS and a PHP version

We strongly recommend to aim for the php 8.1 version.

  • php 7.0 reached its end of life in December 2017, and the last security updates have been done in December 2018
  • php 7.3 reached its end of life in December 2020, and the last security updates have been done in December 2021

Once you've established which version is being used, check the chart below and make sure your CMS is ready for the target php version.

If you CMS does support the newer version, you can directly move on to the "Change PHP version" section.

php_chart_en.png

For SPIP:

For more details about compatibility between version, please visit the page related to your CMS in the #External_resources section.

Make a full backup

Before any changes, no matter which CMS is being used, a backup is mandatory.

Most CMS offer plugins making this easier (e.g.: X-cloner or UpdraftPlus for WordPress).

This procedure doesn't cover the dozens of existing plugins. It focuses on the manual procedure to do so, which is common to most CMS.

For more details about backups, please check your CMS's official documentation (see #External_resources).

In most cases, it involves backing up:

Please note that whatever happens, we backup all your data everyday and keep them for 5 days. If the process goes badly and you didn't make your own backups, it will be possible to ask for a complete restoration (fees apply to any restoration work).

Database

Head to AlternC.

To list existing databases, click on "Databases" on the left side panel.

To display the details (user, password, permissions...), or get to PhpMyAdmin to see your database content, click on "Show settings".

liste_dbs.jpg

You can also access PhpMyAdmin directly from the side panel, under "Databases".

If you only have one database, you can move on to the next step in order to back it up.

If you have multiple databases, and are unsure about which one should be saved, go on with the next section.

Determine which database to backup

The database connection details are usually written in a file placed in your website root folder.

If you don't know what database is related to your CMS because you have multiple databases, you'll have to determine which one stores your website data.

To access the file, click on the "File browser" in the side panel, reach your website root directory, and find you CMS's configuration file.

Click on the file to show its content. E.g.:

gestionnaire_fichier_conf.jpg

If you're unsure about the website root directory, check the #Files section to make sure where are your website files stored.

Export database

Connect to PhpMyAdmin from the database settings or the side panel (MySQL section > PhpMyAdmin).

In the databases management interface, click on your database name on the left side.

Then, click on the "Export" tab at the top.

Leave the settings as is (quick/SQL), and click "Go" to save the database on your computer.

export_db.jpg

Files

The files of your website root directory must be backed up too.

By clicking on your domain to edit it, on alternC's side panel, you should see a field "Locally hosted..." and a directory displayed right under it: this is your website's root directory.

You can click on the directory in order to access the file browser. You can also use the "File browser" section displayed on the left hand menu.

docroot.jpg

If you can't see anything like "Locally hosted..." in the fields, your website might be using HTTPS. In such a case, the fields are shown under the "Advanced subdomains section" and are not available for non-admins users. You can still access the files through the File browser.

If you're not using HTTPS, you website might be hosted somewhere else (it could be on a private server for instance).

Do not hesitate to contact us if you have question regarding this.

Once in your root directory, in the file browser, click on "Download this folder" at the bottom to get an archive of your files. Note that it can take a while, depending on your folder size.

archive_files.jpg

Upgrade

Unfortunately, this documentation can't cover all the specific steps to upgrade each existing CMS.

We invite you to refer to your CMS's official documentation in the #External_resources section.

Once upgraded to a version of your CMS compatible with the php version you aim at, you can move on to the last step: changing the PHP version used by your website.

  • WordPress: it's recommanded to update the core first, then themes, plugins and finally translations

  • Drupal: it's recommanded to update modules prior to updating the core

Change PHP version

Before changing the PHP version, we recommand to temporarily lower the domain TTL (time to live) to 600s. This way, changes will be applied faster, and you'll be able to reverse the change quicker in case anything goes wrong.

To do so, click on the "Settings" tab from the domain edition page. Take note of the currently used TTL in order to put it back at its original value once done:

ttl.jpg

Wait for the original TTL time (usually 3600s / 1h) before doing any change.

When ready, click on your domain, then on the "edit" button" on the left:

changer_php_1.jpg

Copy-paste the current path to your root directory in the corresponding field for the new php version, and check the radio button next to it:

Example with a change from PHP 7.3 to PHP 8.1:

changer_php_2.jpg

Now, it's time to check that your website is running smoothly! (Make sure you let time for the change to apply).

If you see any problem, change back to your original PHP version to revert the modification.

If everything looks good, congratulations, you're done and you can change your domain's TTL back to its original value!

External DNS

If your DNS zone isn't managed in alternC, here are the DNS records you'll need (A or CNAME):

External resources

WordPress

Drupal

Joomla

SPIP

NextCloud

MediaWiki


CategoriePagePublique

Switch a CMS to a newer version of php (last edited 2022-07-04 11:24:47 by john)