Is your Ubuntu server still running PHP 7.x or 8.0/8.1/8.2? Upgrading to PHP 8.4 delivers improved performance, enhanced typing features, better syntax, bug fixes, and more robust security. Whether your server is on AWS, Azure, GCP, or a private cloud, this walkthrough shows you how to upgrade smoothly.

Enhanced readonly classes and properties
Improved type system & more stable union types
Performance optimizations and reduced memory overhead
Newly introduced functions and deprecations of unsafe or legacy code
Extended support and security patches
Before you begin:
You have sudo or root access on your Ubuntu server
SSH access or terminal access
Backup of existing code/configuration in case you need to rollback
Test environment (if possible), especially for live/production servers
sudo apt update
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php8.4
Install necessary modules based on your applications (adjust as needed):
sudo apt install \
php8.4-common \
php8.4-cli \
php8.4-fpm \
php8.4-mysql \
php8.4-curl \
php8.4-opcache \
php8.4-mbstring \
php8.4-xml \
php8.4-zip \
php8.4-readline
Note: If you use a web server like Apache, you may need php8.4-apache2 or equivalent. For Nginx + PHP-FPM, ensure your FPM pool is configured correctly.
If you’re using Apache:
sudo a2dismod php8.0   # or php8.1, etc., whatever version is currently active
sudo a2enmod php8.4
sudo service apache2 restart
If using Nginx + PHP-FPM, update your site config to point to the PHP 8.4 FPM socket and restart both Nginx and php8.4-fpm:
sudo systemctl restart php8.4-fpm
sudo systemctl restart nginx
If the php -v command still shows an old version:
sudo update-alternatives --config php
Choose the version showing /usr/bin/php8.4 (or similar). Also update phpize, php-config if needed.
php -v
Expected output should include something like:
PHP 8.4.x (cli) (built: …)
…
Also check:
<?php phpinfo(); ?>)php.ini) for new settings or changes introduced in PHP 8.4| Problem | Solution | 
|---|---|
| Some module not found / extension missing | Install via apt install php8.4-<module> | 
| Web server still shows old version | Disable old PHP module, enable new one, restart web server, check update-alternatives | 
| Permissions / socket issues with PHP-FPM | Check ownership/group of FPM socket; match Nginx/Apache configuration | 
Upgrading to PHP 8.4 on Ubuntu is highly recommended for better security, modern features, and performance improvements. With careful preparation and following the steps above, you can upgrade smoothly with minimal downtime.
If you need help with custom configuration, module compatibility, or migration issues, feel free to reach out.