Php8.1 update

Some of our customers ask for a guide on updating PHP. We are not supporting the system beneath the eramba, but I believe it may help some of you. It may of course differ on different servers, this one will work for sure for those using our pre-configured VM.
The process is very straightforward, make sure you are running it as a root user.

Installing PHP 8.1 on Ubuntu 20.04

1. Run system updates

$ apt update && apt upgrade -y

2. Add Ondrey sury PPA repository

$ add-apt-repository ppa:ondrej/php

3. Update repositories again

$ apt update

4. Install PHP 8.1 and all modules needed for eramba

$ apt install php8.1 php8.1-mysql php8.1-intl php8.1-curl php8.1-mbstring php8.1-xml php8.1-zip php8.1-ldap php8.1-gd php8.1-bz2 php8.1-sqlite3 php8.1-redis

5. Copy php.ini files from the previous PHP version

$ cp /etc/php/7.x/apache2/php.ini /etc/php/8.1/apache2/.
$ cp /etc/php/7.x/cli/php.ini /etc/php/8.1/cli/.

6. Disable php7.4

$ a2dismod php7.4

7. Enable php8.1

$ a2enmod php8.1

8. Restart apache

$ systemctl restart apache2

9. Make sure that cli and apache using same PHP version

for cli:

$ php -v

for apache:

1 Like