Install php 8.1
Add the necessary repository.
$ sudo apt install software-properties-common
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt update
Install PHP 8.
$ sudo apt install php8.1
Install Modules
Install related PHP modules
Here are some common ones
sudo apt install php8.1-common php8.1-fpm php8.1-mysql php8.1-xml php8.1-xmlrpc php8.1-curl php8.1-mbstring php8.1-gd php8.1-opcache php8.1-readline php8.1-zip php8.1-intl php8.1-cli php8.1-apcu
but you can check what you have installed and need to replace by running this command
list installed php modules
$ dpkg -l | grep php7.4
Set up FPM config files
a2enmod proxy_fcgi setenvif
a2enconf php8.1-fpm
Copy any custom pools modifications to your new pool directory
cp custom.conf /etc/php/8.1/fpm/pool.d
in the new directory /php/8.1/fpm/pool.d
find and replace any references to old php version
nano domain.conf
then start or restart the service
systemctl start php8.1-fpm.service
Edit any and all apache host files you wish to run on the new version
cd /etc/apache2/sites-available
nano domain.com.conf
replace old php version with new version
<FilesMatch \.php$>
# Apache 2.4.10+ can proxy to unix socket
SetHandler "proxy:unix:/run/php/php8.1-fpm-username.sock|fcgi://localhost/"
#SetHandler "proxy:fcgi://127.0.0.1:9000"
</FilesMatch>
-
Restart the Apache web server.
$ sudo systemctl restart apache2.service
- Log in to post comments