PHP 8.4 is the latest stable release of PHP, bringing property hooks, new array functions, improved JIT performance, and deprecation of outdated features. This guide installs PHP 8.4 on Ubuntu 26.04 LTS using both the default Ubuntu repositories and the popular Ondrej Sury PPA.
Tested and valid on:
- Ubuntu 26.04 LTS
Prerequisites
- Ubuntu 26.04 LTS server or desktop
- A user with sudo privileges
Step 1 – Update Package List
sudo apt update
Step 2 – Install PHP 8.4 from Ubuntu Repos
Ubuntu 26.04 ships with PHP 8.4 in the main repository:
sudo apt install php8.4 php8.4-cli php8.4-fpm php8.4-common -y
Step 3 – Install Common PHP Extensions
sudo apt install php8.4-mbstring php8.4-xml php8.4-curl php8.4-zip
php8.4-mysql php8.4-pgsql php8.4-sqlite3 php8.4-gd php8.4-intl
php8.4-bcmath php8.4-soap -y
Step 4 – Verify Installation
php -v
php -m | sort
Step 5 – Configure PHP CLI
Edit the CLI php.ini for development settings:
sudo nano /etc/php/8.4/cli/php.ini
Common tweaks:
memory_limit = 256M
max_execution_time = 120
upload_max_filesize = 64M
post_max_size = 64M
Step 6 – Configure PHP-FPM
PHP-FPM handles FastCGI requests from Nginx:
sudo systemctl start php8.4-fpm
sudo systemctl enable php8.4-fpm
sudo systemctl status php8.4-fpm
The socket is at /run/php/php8.4-fpm.sock.
Step 7 – Use Ondrej PPA for Latest PHP (alternative)
If Ubuntu’s bundled version is behind, use the Ondrej Sury PPA:
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:ondrej/php -y
sudo apt update
sudo apt install php8.4 -y
Conclusion
PHP 8.4 is installed on your Ubuntu 26.04 LTS server. Configure it with Nginx or Apache to serve dynamic web applications. Install Composer next to manage PHP package dependencies.