Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

  1. Setup

  2. Remove libapache2-mod-php7.4

  3. Install PHP 8.1

  4. Install php-fpm 7.4 and 8.1

  5. Enable php-fpm 7.4 and 8.1

  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:

Code Block
languagebash
themeMidnight
// *************
// Ubuntu 20
// *************
sudo add-apt-repository ppa:ondrej/php

...

How to Remove:

Code Block
languagebashthemeMidnight
// *************
// Ubuntu 20
// *************
sudo apt remove libapache2-mod-php7.4

...

How to Install and Enable:

Code Block
languagebashthemeMidnight
// *************
// Ubuntu 20
// ************* 
sudo apt install php8.1 php8.1-fpm php7.4-fpm
// omit mysql if using oracle and install the oracle plugin instead
sudo apt install -y php8.1-{opcache,intl,zip,common,redis,mbstring,sqlite3,cli,xml,curl,gd,apcu,soap,mysqlnd}
a2enmod proxy_fcgi setenvif
a2enconf php7.4-fpm
a2enconf php8.1-fpm 

...

How to Install and Enable:

Code Block
languagebashthemeMidnight
// *************
// Ubuntu 20
// *************  
// 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 7.4 should be mapped to the environment that is not being updated (so still requires it)
<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php/php7.4-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>

...