I recently faced the challenge of upgrading our servers from PHP 7.4 to 8.4. Managing a server of 15 web servers hosting over 10 different PHP applications, I knew this upgrade needed careful planning and execution. Our setup includes WordPress sites, and some old PHP applications.
Why I Decided to Upgrade
PHP 7.4 reached its end of life, meaning no more security updates. Plus, version 8.4 offers better performance and new features that our web applications could benefit from.
Before You Start
Before jumping into the upgrade, here’s what you need to check:
- Back up your entire system
- List all your current PHP applications
- Check if your apps work with PHP 8.4
- Write down your current PHP settings
Step-by-Step Upgrade Process
1. Check Your Current PHP Version
First, I checked my PHP version:
php -v
2. Add the PHP 8.4 Repository
I added the repository to get the 8.4:
sudo add-apt-repository ppa:ondrej/php
sudo apt update
3. Install version 8.4
Here’s how I installed all the 8.4 version:
sudo apt install php8.4-fpm php8.4-common php8.4-mysql php8.4-xml php8.4-curl php8.4-gd php8.4-imagick php8.4-cli php8.4-dev php8.4-imap php8.4-mbstring php8.4-opcache php8.4-soap php8.4-zip
4. Switch to 8.4
I switched the default PHP version:
sudo update-alternatives --set php /usr/bin/php8.4
5. Update Nginx Configuration
I updated my Nginx config to use 8.4 version:
fastcgi_pass unix:/var/run/php/php8.4-fpm.sock;
6. Restart Services
sudo systemctl restart php8.4-fpm
sudo systemctl restart nginx
Performance Improvements I Saw
- Website load times dropped by 30%
- Database operations got faster
- Lower CPU usage on the server
Final Thoughts
The upgrade to 8.4 was worth the effort. Our sites run faster, use less resources, and we’re now ready for future updates.
Need Help?
If you run into issues during your upgrade, feel free to leave a comment below or check the official PHP documentation.