How to Install PHP 8.5 on Ubuntu 22.04
PHP is a widely used open-source scripting language primarily designed for web development.
It can be embedded into HTML and works with many databases and frameworks.
In this guide, we will show you how to install PHP 8.5 on Ubuntu 22.04 (Jammy Jellyfish).
Prerequisites
- A system running Ubuntu 22.04
- Root access or a user with sudo privileges
Step 1: Connect to your Server
Connect to your server via SSH.
ssh root@your_server_ip
Replace
your_server_ipwith the IP address of your server.
Step 2: Update the System
Update the package list and upgrade installed packages.
apt update && apt upgrade -y
Step 3: Install Required Packages
Install the required packages to add external repositories.
apt install software-properties-common ca-certificates lsb-release apt-transport-https -y
Step 4: Add the PHP Repository
Add the Ondřej Surý PHP PPA, which provides the latest PHP versions.
add-apt-repository ppa:ondrej/php
Press Enter when prompted.
Update the package index:
apt update
Step 5: Install PHP 8.5
Install PHP 8.5 using the following command:
apt install php8.5 -y
Step 6: Install Common PHP Extensions
Install commonly used PHP extensions required by many applications.
apt install php8.5-cli php8.5-common php8.5-curl php8.5-mbstring php8.5-xml php8.5-zip php8.5-gd php8.5-intl php8.5-mysql -y
Step 7: Verify PHP Installation
Check the installed PHP version:
php -v
Example output:
PHP 8.5.3 (cli) (built: Feb 13 2026 16:00:46) (NTS)
Copyright (c) The PHP Group
Built by Debian
Zend Engine v4.5.3, Copyright (c) Zend Technologies
with Zend OPcache v8.5.3, Copyright (c), by Zend Technologies
Step 8: Install PHP-FPM (Optional)
If you are using Nginx or Apache with PHP-FPM, install PHP-FPM.
apt install php8.5-fpm -y
Enable and start the service:
systemctl enable php8.5-fpm
systemctl start php8.5-fpm
Check the service status:
systemctl status php8.5-fpm
Conclusion
You have successfully installed PHP 8.5 on Ubuntu 22.04.
You can now configure your web server (Apache or Nginx) to use PHP and start deploying PHP-based
CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!
1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month
Available Locations: LAX | MIA | ATL | FRA | AMS