Skip to main content
Skip table of contents

PHP 8.3 Upgrade

Overview

  1. Setup

  2. Remove libapache2-mod-php7.4

  3. Install PHP 8.3

  4. Install php-fpm 8.1 and 8.3

  5. Enable php-fpm 8.1 and 8.3

  6. Update Virtual Hosts to use the appropriate PHP version

  7. Restart Apache

Setup

Install Repository

In order to complete this upgrade, a repository (repo) with all of the dependencies must be installed. Listed below are the suggested repos for each operating system.

How to Install:

BASH
// *************
// Ubuntu 22
// *************
sudo add-apt-repository ppa:ondrej/php

Remove libapache2-mod-php7.4

Why Remove?

The mod only allows a single PHP version running on the server and will interfere with php-fpm.

How to Remove:

BASH
// *************
// Ubuntu 22
// *************
sudo apt remove libapache2-mod-php7.4

Install and Enable PHP_FPM 8.3, and PHP_FPM 8.1

First install the services to handle each PHP version. Then, Apache needs the support for multiple version enabled.

How to Install and Enable:

BASH
// *************
// Ubuntu 22
// ************* 
sudo apt install php8.3 php8.1-fpm php8.3-fpm
// omit mysql if using oracle and install the oracle plugin instead
sudo apt install -y php8.3-{opcache,intl,zip,common,redis,mbstring,sqlite3,cli,xml,curl,gd,apcu,soap,mysqlnd,mongodb,rapfh}
a2enmod proxy_fcgi setenvif
a2enconf php8.3-fpm
a2enconf php8.1-fpm 

Update Virtual Hosts to use the appropriate PHP Version

Each Virtual host using PHP will need to be configured to proxy to the php version is  needs to run.

How to Install and Enable:

BASH
// *************
// Ubuntu 22
// *************  
// this must be performed for all affected virtual hosts
vi /etc/apache2/sites-available\pcr360_prod.conf

// Add these line to the end of the virtual host (just before the </VirtualHost> tag)
// Remember to use the appropriate PHP Version for the Virtual Host

// PHP 8.3 should be mapped to the environment that is not being updated (so still requires it)
<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php/php8.3-fpm.sock|fcgi://localhost"
</FilesMatch>

// PHP 8.1 should be mapped to the environment being updated
<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php/php8.1-fpm.sock|fcgi://localhost"
</FilesMatch>


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.