Upgrade the PHP version

Published

Updated

🐘

Upgrade PHP locally first, update the dependencies and test, then switch the version of the environment in the dashboard and deploy. Switching back works as long as the old version is available.

PHP versions on fortrabbit

Each environment runs one PHP version, set in the PHP settings in the dashboard. It applies to the environment, the deployment service and jobs.

  • Latest version keeps the environment on the newest available PHP version.
  • A pinned version stays as it is until fortrabbit retires it. Versions past their end of life can cost extra, see legacy PHP versions.

New PHP versions arrive some time after their release, once the first patch release is out and the extensions are updated. See the update policies.

Upgrade step by step

  1. Upgrade PHP locally. How depends on the local development environment; in DDEV, ddev config --php-version=8.4.
  2. Update the dependencies. composer outdated lists outdated packages, composer why-not php 8.4 names the packages that block the new version. Update a CMS locally too, see the guides for Craft CMS and WordPress.
  3. Test locally. Click through the site and run the tests. Static analysis, such as PHPStan or Rector, finds deprecated functions in own code.
  4. Switch the version on fortrabbit and save:
  5. Deploy the updated code with git, SFTP or rsync, and run database migrations if the software needs them.
  6. Check the site and the logs. If it fails, switch back to the previous version and fix the problem locally.

To try the new version without touching production, create a second environment, switch its version and deploy there first.

Frequently asked

Can I switch back to the previous PHP version on fortrabbit?

Yes, select it again in the PHP settings of the environment, as long as that version is still available. Retired versions can no longer be selected.

#
What happens when my PHP version reaches end of life?

It stays available as is, without security fixes, and can cost a monthly fee on top of the PHP component. When fortrabbit retires the version, environments still on it are upgraded to the next newer version.

#

Written by humans and AI in collaboration.

AI use & editorial processEdit on GitHub ↗