---
title: 'How to upgrade PHP from version 8.1 to 8.4'
url: 'https://ra1ahq.blog/en/kak-obnovit-php-s-versii-8-1-na-8-4'
markdown: 'https://ra1ahq.blog/en/kak-obnovit-php-s-versii-8-1-na-8-4.md'
lang: en
date: '2026-08-14'
description: 'In 2026, there are two ways to update PHP. Introd'
taxonomy:
  category:
    - blog
  tag:
    - Linux
  archives_month:
    - aug_2026
  archives_year:
    - '2026'
---

# How to upgrade PHP from version 8.1 to 8.4

14 

 August 

 2026 

 ![How to upgrade PHP from version 8.1 to 8.4](https://ra1ahq.blog/images/a/8/d/d/a/a8ddae733ceff6b34418219bdb060b8c7c707c5f-solution1title.png)14:58

### How to upgrade PHP from version 8.1 to 8.4

 [Linux](https://ra1ahq.blog/en/tag:Linux) 

14 August 2026 14:58

In 2026, there are two ways to update PHP.

### Introduction

Many versions of Linux still use PHP 8.1. Modern projects may require a newer version of 8.3 or 8.4 to run. The latest version available for installation is PHP 8.5.

**First way**- installing PHP 8.3, 8.4 or 8.5 from the oandrej PPA repository

```
sudo add-apt-repository ppa:ondrej/apache2
sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
```

**Second way**- installing PHP from a third-party deb repository https://packages.sury.org/php/
In the article I looked at the second method - deb from packages.sury.org/php/.

### How to install new versions of PHP

First of all, I recommend disabling the previous repository and removing the outdated PHP7.

```
sudo add-apt-repository --remove ppa:ondrej/php
sudo apt remove php7*
```

Message:

> This repository is in the process of being merged into https://packages.sury.org/php/

If you read on the website <https://packages.sury.org/php> file [README.txt](https://packages.sury.org/php/README.txt), the installation path is as follows:

1\) prepare for installation: update the package cache and install the utilities that are needed to download the repository key file from the Internet.

```
sudo apt-get update
sudo apt-get -y install lsb-release ca-certificates curl
```

2\) from the debsuryorg-archive-keyring.deb package downloaded from https://packages.sury.org/
install the repository signing key on your local PC.

First, download the package installation DEB file to the tmp folder:

```
curl -sSLo /tmp/debsuryorg-archive-keyring.deb \
https://packages.sury.org/debsuryorg-archive-keyring.deb
```

Then install the package with the key

```
sudo dpkg -i /tmp/debsuryorg-archive-keyring.deb
```

The key will appear in the /usr/share/keyrings/ folder,
where is the name of the keychain file:`debsuryorg-archive-keyring.gpg`

3\) In the /etc/apt/sources.list.d/ folder, create an entry for the new repository

The php.list file has one line content:

`deb [signed-by=/usr/share/keyrings/debsuryorg-archive-keyring.gpg] https://packages.sury.org/php/ jammy main`

Where instead of jammy you need to indicate the code name of your distribution.
The distribution name can be found with the command

```
lsb_release -a
```

You can also find out the codename by the Linux version number.
The most popular versions of Linux have code words:

- Ubuntu 20.04 LTS -**focal**
- Ubuntu 22.04 LTS -**jammy**
- Ubuntu 24.04 LTS -**noble**
- Linux Mint 21 -**jammy**
- Linux Mint 22 -**noble**
- Debian 11 -**bullseye**
- Debian 12 -**bookworm**
- Debian 13 -**trixie**

4\) Installing php 8.4

```
sudo apt-get update
sudo apt-get install php8.4-common
```

5\) Checking the PHP version

```
php --version
```

Output: `PHP 8.4.24`

The PHP version has been updated successfully.

### Problems and solutions

In Linux Mint 21, there was an issue updating php8.4-gd due to a dependency on libgd3, which requires a version >= 2.3.3, but the installation candidate in the repository is 2.3.0.

Solution: The Linux operating system repository priority may be higher than that of a third-party repository, preventing programs and libraries from being installed from the third-party repository.

**Creating a file to indicate installation priority, i.e. pinning packages to a repository: APT Pinning**

```
sudo nano /etc/apt/preferences
```

File Contents:

```
Package: libgd3
Pin: release o=deb.sury.org
Pin-Priority: 1001

Package: php*
Pin: release o=deb.sury.org
Pin-Priority: 1001
```

1001 - means the highest priority, which is higher than that of the OS system repository.

Previously, the LibGD3 library from the Ubuntu system repository conflicted with the PHP graphics module requirement `php8.4-gd` use LibGD3 version 2.3.3,

- in the system repository version 2.3.0,
- version 2.3.3 from the deb.sury.org repository will be installed as having a higher priority of 1001.

The command says this:

```
apt-cache policy libgd3
```

Now there will be no error. We do it as usual:

```
sudo apt-get update
sudo apt-get install php8.4-common
```

### Checking PHP version

```
php --version
```

### Switching PHP version in OS by default

Only if the PHP version is not the one required:

```
sudo update-alternatives --config php
```

### Installing the Apache HTTP Server Module

```
sudo apt-get install libapache2-mod-php8.4
```

### Causes of the error "undefined constant IMG\_JPG"

When running a PHP project that uses graphics, you may receive an error regarding IMG\_JPG

If you have completed the previous steps (installing php one of the latest 8.x versions), you need to additionally install the module:

```
sudo apt-get install libgd3
sudo apt-get install php8.4-gd
```

### List of Apache2 modules to install

For the project, I additionally installed the Apache web server packages and modules:

```
sudo apt install php8.4 php8.4-cli php8.4-common
sudo apt install libapache2-mod-php8.4 
sudo apt install php8.4-curl php8.4-intl php8.4-mbstring php8.4-mysql
sudo apt install php8.4-readline php8.4-xml php8.4-yaml php8.4-zip php8.4-apcu
```

### Enabling the PHP module

```
sudo a2enmod php8.4
sudo service apache2 restart
```

### Switching FastCGI FPM / regular module configuration

The status of the module can be found with the command

```
sudo systemctl status php8.4-fpm
```

If the FPM module doesn't exist or the FPM version is the same as PHP (i.e. 8.4), do nothing.

If the PHP and FPM versions are different, disable the FCGI and FPM modules:

```
sudo a2dismod actions alias proxy_fcgi
sudo a2disconf php8.4-fpm
```

And enable them:

```
sudo a2enconf php8.4-fpm
sudo a2enmod actions alias proxy_fcgi
```

---

This article has been tested with PHP version 8.4, but may work with versions 8.3 and 8.5 if you replace the corresponding numbers in the terminal commands.

### Related publications

 [ ![](https://ra1ahq.blog/images/d/2/5/c/7/d25c7282750b398f71041fb8b90640b692e7e4b8-decibelfmtitle.png) Linux Cinnamon Desktop Applets for Listening to Internet Radio Stations ](https://ra1ahq.blog/en/applety-dlya-rabochego-stola-linux-cinnamon-dlya-proslushivaniya-internet-radiostancii) 

 [ ![No picture](https://ra1ahq.blog/user/themes/mytheme/images/no-image.png) Passing a parameter to a Linux module/driver ](https://ra1ahq.blog/en/peredacha-parametra-modulyu-draiveru-linux) 

 [ ![](https://ra1ahq.blog/images/5/c/4/e/a/5c4ea9c8c3f0b4dd890116d8fe7cbadfdb9814ba-archer-ac600.webp) Installing the TP-Link Archer T600U Nano Wi-Fi adapter driver in Debian 13 "Trixie" ](https://ra1ahq.blog/en/ustanovka-draivera-wi-fi-adaptera-tp-link-archer-t600u-nano-v-debian-13-trixie) 

 [ ![](https://ra1ahq.blog/images/b/f/f/0/f/bff0f99f5897e0420fac9a6eef7254247f39c29d-pulseaudio-equalizer.png) Installing the audio equalizer pulseaudio-equalizer-ladspa on Linux ](https://ra1ahq.blog/en/ustanovka-v-linux-ekvalaizera-zvuka-pulseaudio-equalizer-ladspa) 

 [ ![](https://ra1ahq.blog/images/e/6/d/7/1/e6d71e1e85f93d0c7c19f4841dad7aadd8f1e02b-lvmschemerus.png) Установка Sparky Linux (Debian) на раздел LVM ](https://ra1ahq.blog/en/ustanovka-sparky-linux-debian-na-razdel-lvm) 

[ Backward](https://ra1ahq.blog/en/file-stations-json-dlya-radio-radio-driglu4it "Previuous page")

[ Forward ](https://ra1ahq.blog/en/oblachnyi-pokrov-18-avgusta-2026-goda "Next page")

## Languages

- [Русский](https://ra1ahq.blog/posts/kak-obnovit-php-s-versii-8-1-na-8-4)
- [English](https://ra1ahq.blog/en/kak-obnovit-php-s-versii-8-1-na-8-4)
- [Deutsch](https://ra1ahq.blog/de/posts/kak-obnovit-php-s-versii-8-1-na-8-4)
- [Français](https://ra1ahq.blog/fr/posts/kak-obnovit-php-s-versii-8-1-na-8-4)
- [中文 (简体) (cn)](https://ra1ahq.blog/zh-cn/posts/kak-obnovit-php-s-versii-8-1-na-8-4)

## Theme

## RSS feeds

 [ Atom 1.0](https://ra1ahq.blog/en/.atom) [ RSS](https://ra1ahq.blog/en/.rss) 

## Popular tags

 [APRS](https://ra1ahq.blog/en/tag:APRS) [CW](https://ra1ahq.blog/en/tag:CW) [DX](https://ra1ahq.blog/en/tag:DX) [FM](https://ra1ahq.blog/en/tag:FM) [Linux](https://ra1ahq.blog/en/tag:Linux) [VHF](https://ra1ahq.blog/en/tag:VHF) [antennas](https://ra1ahq.blog/en/tag:antennas) [firefox](https://ra1ahq.blog/en/tag:firefox) [morse](https://ra1ahq.blog/en/tag:morse) [soundtrack](https://ra1ahq.blog/en/tag:soundtrack) [video](https://ra1ahq.blog/en/tag:video) [windows](https://ra1ahq.blog/en/tag:windows) [youtube](https://ra1ahq.blog/en/tag:youtube) [КВ](https://ra1ahq.blog/en/tag:%D0%9A%D0%92) [ТВ](https://ra1ahq.blog/en/tag:%D0%A2%D0%92) [УКВ](https://ra1ahq.blog/en/tag:%D0%A3%D0%9A%D0%92) [антенны](https://ra1ahq.blog/en/tag:%D0%B0%D0%BD%D1%82%D0%B5%D0%BD%D0%BD%D1%8B) [безопасность](https://ra1ahq.blog/en/tag:%D0%B1%D0%B5%D0%B7%D0%BE%D0%BF%D0%B0%D1%81%D0%BD%D0%BE%D1%81%D1%82%D1%8C) [длинные волны](https://ra1ahq.blog/en/tag:%D0%B4%D0%BB%D0%B8%D0%BD%D0%BD%D1%8B%D0%B5%20%D0%B2%D0%BE%D0%BB%D0%BD%D1%8B) [путешествия](https://ra1ahq.blog/en/tag:%D0%BF%D1%83%D1%82%D0%B5%D1%88%D0%B5%D1%81%D1%82%D0%B2%D0%B8%D1%8F) [религия](https://ra1ahq.blog/en/tag:%D1%80%D0%B5%D0%BB%D0%B8%D0%B3%D0%B8%D1%8F) [соревнования](https://ra1ahq.blog/en/tag:%D1%81%D0%BE%D1%80%D0%B5%D0%B2%D0%BD%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F) [спутники](https://ra1ahq.blog/en/tag:%D1%81%D0%BF%D1%83%D1%82%D0%BD%D0%B8%D0%BA%D0%B8) [средние волны](https://ra1ahq.blog/en/tag:%D1%81%D1%80%D0%B5%D0%B4%D0%BD%D0%B8%D0%B5%20%D0%B2%D0%BE%D0%BB%D0%BD%D1%8B) [схемы](https://ra1ahq.blog/en/tag:%D1%81%D1%85%D0%B5%D0%BC%D1%8B) [тесты](https://ra1ahq.blog/en/tag:%D1%82%D0%B5%D1%81%D1%82%D1%8B) [трансивер](https://ra1ahq.blog/en/tag:%D1%82%D1%80%D0%B0%D0%BD%D1%81%D0%B8%D0%B2%D0%B5%D1%80) [управление](https://ra1ahq.blog/en/tag:%D1%83%D0%BF%D1%80%D0%B0%D0%B2%D0%BB%D0%B5%D0%BD%D0%B8%D0%B5) [фотографии](https://ra1ahq.blog/en/tag:%D1%84%D0%BE%D1%82%D0%BE%D0%B3%D1%80%D0%B0%D1%84%D0%B8%D0%B8) 

## Random post

 [ I'll be lucky!](https://ra1ahq.blog/en/random) 

## Archive of posts

- [ October 2026 ✒ 1 ](https://ra1ahq.blog/en/archives_month:oct_2026)
- [ September 2026 ✒ 9 ](https://ra1ahq.blog/en/archives_month:sep_2026)
- [ August 2026 ✒ 6 ](https://ra1ahq.blog/en/archives_month:aug_2026)
- [ July 2026 ✒ 13 ](https://ra1ahq.blog/en/archives_month:jul_2026)
- [ June 2026 ✒ 8 ](https://ra1ahq.blog/en/archives_month:jun_2026)
- [ May 2026 ✒ 2 ](https://ra1ahq.blog/en/archives_month:may_2026)
- [ April 2026 ✒ 6 ](https://ra1ahq.blog/en/archives_month:apr_2026)
- [ March 2026 ✒ 3 ](https://ra1ahq.blog/en/archives_month:mar_2026)
- [ February 2026 ✒ 7 ](https://ra1ahq.blog/en/archives_month:feb_2026)
- [ January 2026 ✒ 8 ](https://ra1ahq.blog/en/archives_month:jan_2026)
- [ December 2025 ✒ 12 ](https://ra1ahq.blog/en/archives_month:dec_2025)
- [ November 2025 ✒ 9 ](https://ra1ahq.blog/en/archives_month:nov_2025)
- [ October 2025 ✒ 8 ](https://ra1ahq.blog/en/archives_month:oct_2025)
- [ September 2025 ✒ 5 ](https://ra1ahq.blog/en/archives_month:sep_2025)
- [ August 2025 ✒ 8 ](https://ra1ahq.blog/en/archives_month:aug_2025)
- [ July 2025 ✒ 6 ](https://ra1ahq.blog/en/archives_month:jul_2025)
- [ June 2025 ✒ 10 ](https://ra1ahq.blog/en/archives_month:jun_2025)
- [ May 2025 ✒ 4 ](https://ra1ahq.blog/en/archives_month:may_2025)
- [ April 2025 ✒ 4 ](https://ra1ahq.blog/en/archives_month:apr_2025)
- [ March 2025 ✒ 4 ](https://ra1ahq.blog/en/archives_month:mar_2025)
- [ February 2025 ✒ 11 ](https://ra1ahq.blog/en/archives_month:feb_2025)
- [ December 2024 ✒ 8 ](https://ra1ahq.blog/en/archives_month:dec_2024)
- [ November 2024 ✒ 2 ](https://ra1ahq.blog/en/archives_month:nov_2024)
- [ October 2024 ✒ 8 ](https://ra1ahq.blog/en/archives_month:oct_2024)
- [ September 2024 ✒ 3 ](https://ra1ahq.blog/en/archives_month:sep_2024)
- [ August 2024 ✒ 5 ](https://ra1ahq.blog/en/archives_month:aug_2024)
- [ July 2024 ✒ 9 ](https://ra1ahq.blog/en/archives_month:jul_2024)
- [ June 2024 ✒ 6 ](https://ra1ahq.blog/en/archives_month:jun_2024)
- [ May 2024 ✒ 7 ](https://ra1ahq.blog/en/archives_month:may_2024)
- [ April 2024 ✒ 5 ](https://ra1ahq.blog/en/archives_month:apr_2024)
- [ March 2024 ✒ 5 ](https://ra1ahq.blog/en/archives_month:mar_2024)
- [ February 2024 ✒ 5 ](https://ra1ahq.blog/en/archives_month:feb_2024)
- [ January 2024 ✒ 6 ](https://ra1ahq.blog/en/archives_month:jan_2024)
- [ December 2023 ✒ 7 ](https://ra1ahq.blog/en/archives_month:dec_2023)
- [ November 2023 ✒ 4 ](https://ra1ahq.blog/en/archives_month:nov_2023)
- [ October 2023 ✒ 8 ](https://ra1ahq.blog/en/archives_month:oct_2023)
- [ September 2023 ✒ 7 ](https://ra1ahq.blog/en/archives_month:sep_2023)
- [ August 2023 ✒ 4 ](https://ra1ahq.blog/en/archives_month:aug_2023)
- [ July 2023 ✒ 7 ](https://ra1ahq.blog/en/archives_month:jul_2023)
- [ June 2023 ✒ 7 ](https://ra1ahq.blog/en/archives_month:jun_2023)
- [ May 2023 ✒ 5 ](https://ra1ahq.blog/en/archives_month:may_2023)
- [ April 2023 ✒ 6 ](https://ra1ahq.blog/en/archives_month:apr_2023)
- [ March 2023 ✒ 5 ](https://ra1ahq.blog/en/archives_month:mar_2023)
- [ February 2023 ✒ 2 ](https://ra1ahq.blog/en/archives_month:feb_2023)
- [ January 2023 ✒ 5 ](https://ra1ahq.blog/en/archives_month:jan_2023)
- [ December 2022 ✒ 7 ](https://ra1ahq.blog/en/archives_month:dec_2022)
- [ November 2022 ✒ 8 ](https://ra1ahq.blog/en/archives_month:nov_2022)
- [ October 2022 ✒ 6 ](https://ra1ahq.blog/en/archives_month:oct_2022)
- [ September 2022 ✒ 9 ](https://ra1ahq.blog/en/archives_month:sep_2022)
- [ August 2022 ✒ 8 ](https://ra1ahq.blog/en/archives_month:aug_2022)
- [ July 2022 ✒ 4 ](https://ra1ahq.blog/en/archives_month:jul_2022)
- [ June 2022 ✒ 9 ](https://ra1ahq.blog/en/archives_month:jun_2022)
- [ May 2022 ✒ 7 ](https://ra1ahq.blog/en/archives_month:may_2022)
- [ April 2022 ✒ 3 ](https://ra1ahq.blog/en/archives_month:apr_2022)
- [ March 2022 ✒ 4 ](https://ra1ahq.blog/en/archives_month:mar_2022)
- [ February 2022 ✒ 6 ](https://ra1ahq.blog/en/archives_month:feb_2022)
- [ January 2022 ✒ 7 ](https://ra1ahq.blog/en/archives_month:jan_2022)
- [ December 2021 ✒ 7 ](https://ra1ahq.blog/en/archives_month:dec_2021)
- [ November 2021 ✒ 7 ](https://ra1ahq.blog/en/archives_month:nov_2021)
- [ October 2021 ✒ 7 ](https://ra1ahq.blog/en/archives_month:oct_2021)
- [ September 2021 ✒ 10 ](https://ra1ahq.blog/en/archives_month:sep_2021)
- [ August 2021 ✒ 6 ](https://ra1ahq.blog/en/archives_month:aug_2021)
- [ July 2021 ✒ 7 ](https://ra1ahq.blog/en/archives_month:jul_2021)
- [ June 2021 ✒ 7 ](https://ra1ahq.blog/en/archives_month:jun_2021)
- [ May 2021 ✒ 7 ](https://ra1ahq.blog/en/archives_month:may_2021)
- [ April 2021 ✒ 4 ](https://ra1ahq.blog/en/archives_month:apr_2021)
- [ March 2021 ✒ 4 ](https://ra1ahq.blog/en/archives_month:mar_2021)
- [ February 2021 ✒ 3 ](https://ra1ahq.blog/en/archives_month:feb_2021)
- [ January 2021 ✒ 4 ](https://ra1ahq.blog/en/archives_month:jan_2021)
- [ December 2020 ✒ 8 ](https://ra1ahq.blog/en/archives_month:dec_2020)
- [ November 2020 ✒ 2 ](https://ra1ahq.blog/en/archives_month:nov_2020)
- [ October 2020 ✒ 3 ](https://ra1ahq.blog/en/archives_month:oct_2020)
- [ September 2020 ✒ 3 ](https://ra1ahq.blog/en/archives_month:sep_2020)
- [ August 2020 ✒ 5 ](https://ra1ahq.blog/en/archives_month:aug_2020)
- [ July 2020 ✒ 5 ](https://ra1ahq.blog/en/archives_month:jul_2020)
- [ June 2020 ✒ 8 ](https://ra1ahq.blog/en/archives_month:jun_2020)
- [ May 2020 ✒ 10 ](https://ra1ahq.blog/en/archives_month:may_2020)
- [ April 2020 ✒ 4 ](https://ra1ahq.blog/en/archives_month:apr_2020)
- [ March 2020 ✒ 2 ](https://ra1ahq.blog/en/archives_month:mar_2020)
- [ January 2020 ✒ 1 ](https://ra1ahq.blog/en/archives_month:jan_2020)
- [ December 2019 ✒ 2 ](https://ra1ahq.blog/en/archives_month:dec_2019)

## Search

## Weather forecast

[На 14 дней](https://world-weather.ru/pogoda/russia/saint_petersburg/14days/)
[world-weather.ru](https://world-weather.ru/)

---

## Navigation

- Parent: [RA1AHQ](https://ra1ahq.blog/en/index.md)
- Previous: [Cloud cover on August 18, 2026](https://ra1ahq.blog/en/oblachnyi-pokrov-18-avgusta-2026-goda.md)
- Next: [File allStations.json for Radio++ (radio@driglu4it)](https://ra1ahq.blog/en/file-stations-json-dlya-radio-radio-driglu4it.md)
