
How to Update PHP Version in Ubuntu (Latest Versions)
Keeping PHP updated is essential for security, performance, and compatibility with modern applications. This guide covers updating PHP on Ubuntu Linux to the latest version.
Step 1: Check the Current PHP Version
Before upgrading, check your installed PHP version by running:
php -v
If your version is outdated, proceed with the update.
Step 2: Update System Packages
Update your package lists to ensure you get the latest software:
sudo apt update && sudo apt upgrade -y
Step 3: Add the Latest PHP Repository
Ubuntu’s default repositories may not include the latest PHP version. To install the most recent version, add the Ondřej Surý PPA, which maintains up-to-date PHP packages:
sudo apt install -y software-properties-common
sudo add-apt-repository ppa:ondrej/php -y
sudo apt update
Step 4: Install the Latest PHP Version
To install the latest PHP version available, run:
sudo apt install -y php
If you need a specific version, specify it explicitly. For example, to install PHP 8.3:
sudo apt install -y php8.3
After installation, verify the version:
php -v
Step 5: Update PHP Extensions
If your application requires additional PHP modules, install them by running:
sudo apt install -y php8.3-cli php8.3-common php8.3-mbstring php8.3-xml php8.3-curl php8.3-zip php8.3-bcmath php8.3-intl php8.3-gd php8.3-mysql
Replace php8.3 with your installed PHP version if needed.
Step 6: Switch PHP Versions (If Needed)
If multiple PHP versions are installed, switch between them using update-alternatives:
sudo update-alternatives –set php /usr/bin/php8.3
To confirm the active PHP version, run:
php -v
Step 7: Restart Web Server
If PHP is used with Apache or Nginx, restart the web server for changes to take effect.
For Apache:
sudo systemctl restart apache2
For Nginx with PHP-FPM:
sudo systemctl restart php8.3-fpm
sudo systemctl restart nginx
Conclusion
You have successfully updated PHP to the latest version on Ubuntu Linux. This ensures better performance, security, and compatibility with modern applications.
Would you like help configuring PHP settings, migrating applications, or troubleshooting compatibility issues? Let me know! ?
Information reviewed and updated: August 28, 2026.
Published by: REVOLD BLOG – blog.revold.us
Powered by AIR RISE INC & REVOLD AI
Sponsored: CORPIUS
Author: Roman Kravchina
Related Reading on Revold Blog
- How to Install Nextcloud with Docker on Your Linux Server
- How to Install and Configure Radarr on Linux Using Docker
- Proxmox Maintenance Script: Automate Updates and Reboots
- How to Install Python Pip on Ubuntu 22.04
- More Developing & Programming guides
- How to Install Jitsi Meet on Ubuntu/Debian with Automatic Let’s Encrypt SSL
- How to Install NGINX FastCGI Cache Purge Module Without Reinstalling NGINX on Ubuntu (Latest Versions)
- This guide will show you how to install a desktop (GUI) graphical interface on your Ubuntu server.
- How to Install Searx Search Engine on Ubuntu / debianArch LinuxFedora / RHEL
- How to Install NVIDIA Drivers on Ubuntu 22.04 LTS
- How to Install Jellyfin Media Server on Ubuntu 24.04
- How To Set Up a Node.js Application for Production on Ubuntu 24.04
- How to Install Virtualmin on Ubuntu 22.04 or 24.04
- How to Install UniFi Controller on Ubuntu 22.04 or 24.04
- Install Docker Compose on Linux Ubuntu 22.04, Debian or up
- How To Install Docker Compose on Ubuntu 22.04
- How to Install a Desktop Environment/GUI in Ubuntu Server
- How to Manually Enable Automatic Updates on Debian and Ubuntu 22.04 / 24.04


