Yes. A server can have several PHP versions installed next to each other, and every site uses one of them. You can move a site to another installed version at any time, and install, update or remove versions per server. Ploi supports PHP 5.6 up to 8.5.
Changing the PHP version of a site
Open the site and click the PHP version in the site details in the sidebar. Pick the version you want from the list. The list only shows up when the server has more than one PHP version installed and you are allowed to manage sites. The PHP version card in the site's Settings does the same.
Both only offer versions that are installed on the server. If the version you need isn't there, install it first, see below.
The switch takes a few seconds. Ploi points the site's NGINX configuration, and that of its tenants, at the PHP-FPM socket of the new version and reloads NGINX. The site keeps running during the switch.
Check these after switching
The deploy script. Ploi changes the PHP-FPM reload line, such as
service php8.3-fpm reload, to the new version. Lines that call a fixed version, such asphp8.3 artisan migrate, stay as they are. Write{SITE_PHP}instead ofphp8.3and{SITE_COMPOSER}instead ofcomposer, those always use the site's current version.Queue workers. Every queue worker has its own PHP version. Click Edit on the worker and pick the new version. A worker without a version uses the server's CLI version.
Cron jobs and daemons you added yourself that call a fixed version, such as
php8.3.Your application. Make sure your code and its Composer packages support the new version before you switch. A staging site is a good place to try it first.
Sites with their own system user
A site that runs under its own system user has its own PHP-FPM pool for each PHP version. When you switch such a site, Ploi creates a pool for the new version if there isn't one yet and restarts PHP-FPM of that version. That restart breaks off requests that other sites on the same version are handling at that moment.
Installing and removing PHP versions
Open the server and go to PHP. The PHP version card lists every version Ploi supports and marks the ones on the server as Installed. Click Install to add a version. Installing takes a few minutes, runs one version at a time and doesn't change any site. If an installation looks stuck, a Cancel button appears. It only resets the status in Ploi, so check the server logs to see what happened on the server.
Each installed version has these options:
Set as CLI picks the version that runs when you type
phpover SSH, and in cron jobs and workers that call plainphp.Set as default, under Edit, picks the version for sites you create from now on. Existing sites keep their version.
Patch updates the version to its latest patch release, for example from 8.3.10 to 8.3.14.
Edit FPM ini, Edit CLI ini and Edit pool, under Edit, open the configuration files of that version. See How do I edit the php.ini file?
Uninstall removes the version. The default version can't be uninstalled. When sites still use the version, Ploi asks whether it may move them to the default version first.
Upload size, memory limit and maximum execution time are set for the whole server in the PHP settings card on the same page, see How can I change the max upload size?
Good to know
On Ubuntu 18.04, PHP 8.2 and newer can't be installed.
On older servers that run Apache behind NGINX, Apache can only use one PHP version. Switching one site there switches every site on the server.