Php8.2 update - "source code" installs

This guide is only for customers running old “source code” installations.
For those running dockerised version use this guide: Php8.2 update - dockerised version

Installing PHP 8.2 on Ubuntu 22.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.2 and all modules needed for eramba

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

*For RHEL and CentOS:

$ dnf install php8.2 php8.2-mysql php8.2-intl php8.2-curl php8.2-mbstring php8.2-xml php8.2-zip php8.2-ldap php8.2-gd php8.2-bz2 php8.2-sqlite3 php8.2-redis php8.2-process

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

$ cp /etc/php/8.1/apache2/php.ini /etc/php/8.2/apache2/.
$ cp /etc/php/8.1/cli/php.ini /etc/php/8.2/cli/.

6. Disable php8.1

$ a2dismod php8.1

7. Enable php8.2

$ a2enmod php8.2

8. Restart apache

$ systemctl restart apache2

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

for cli:

$ php -v

for apache:

reference: How To Install PHP 8.2 on Ubuntu 22.04 - TechvBlogs

Hi Sam,
thank you for Information!

We try to perform PHP update but facing now an issue with upgrade to PHP8.2 on Ubuntu 18.04 we have:

“Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package php8.2
E: Couldn’t find any package by glob ‘php8.2’
E: Couldn’t find any package by regex ‘php8.2’

I can’t find a good solution in internet - only update to Ubuntu 22.04 but it is difficult now.
Do you have any ideas?
br,
Oleg

Couple things (before Sam’s official response).

Ubuntu 18.04 is out of support now and is no longer receiving security updates. You really should upgrade to at least 20.04 (fairly easy without breaking things), but 22.04 would be better. You should be able to do an in-place upgrade using “do-release-upgrade”.

To find the package you’d need to add the right repo for it - I usually have to manually add it to fresh Ubuntu installs. Of course, you’ll have to re-add the repo after the upgrade - I think the right rep is ppa:ondrej/apache2. Of note, I don’t know if that PPA publishes PHP8.2 for Ubuntu 18.04 - if it doesn’t, you’ll either have to build PHP from source yourself or upgrade to a newer Ubuntu version (which you should anyway).

Agree with @david.schroth

Hi,
Linux and PHP8.2 updated,
thank you