Appearance
Managing PHP Version updates on the server
Updating PHP Version
When a decision is made to update the PHP version on an app, the following steps need to be taken:
- Update the
php
version in thecomposer.json
file before it pushed to the server. And ensure this is working well on a local environment. - Ensure any dependencies are compatible with the new PHP version.
- Make sure that any git workflows are updated to handle the new PHP version.
- Navigate to the server on
Forge
and install the new PHP version if it's not already installed. - Check what extensions are installed on the previous PHP version (it is uncommon but some servers like Engauge have specific extensions installed). You can check this by running
php8.1 -m
in the terminal for instance for PHP 8.1. Take a list of all of these, and compare for any different extensions on the new PHP version (for instance runphp8.1 -m
andphp8.2 -m
to compare).
- 5.1 If there are any missing extensions, install them on the new PHP version. Google for the correct commands to install the extensions on the new PHP version.
- Set the new default PHP version for the CLI and sites on
Forge
(if required). Note if there are multiple sites on the same server, please be aware that changing the defaults could cause failures on the other sites.
- When preparing to merge the PHP and associated code changes to
main
make sure to update Envoyer to handle the new PHP Version.
- 7.1 First we must edit the server in Envoyer
- 7.2 Then we must update any git hooks that rely on the PHP version, such as migrations etc. Make sure to check and update each hook as required.
When deploying the steps before will need to be in place. The steps after this will need to take place immediately after the deployment is complete. There may be a short period of downtime while the PHP version is updated, please ensure that this is communicated to the team and any stakeholders and done at an appropriate time.
Ensure that any affected
daemons
on Forge are updated to use the new PHP version if required
- Check the
Scheduler on Forge
to ensure that the correct PHP version is being used, if there are multiple apps on the same server this may need to be updated
- You can set the PHP version for each site on the server in the
Site
settings on Forge
- It may be necessary that the server needs to be restarted on Forge to ensure that the PHP version is correctly updated. The following checks can be done after this
- 12.1 Check that horizon is running
- 12.2 Check that the site is running
- 12.3 Trigger a safe action (password reset email to yourself) to check that jobs are firing