Upgrading PHP improves security and performance. On Ubuntu LTS the usual path is Ondřej's PPA.
Steps
Add the PPA and install the target version (8.3 example):
sudo apt updatesudo apt install -y software-properties-commonsudo add-apt-repository -y ppa:ondrej/phpsudo apt updatesudo apt install -y php8.3-fpm php8.3-mysql php8.3-xml php8.3-curl php8.3-mbstringCheck the CLI version and that FPM is running:
php8.3 -vsudo systemctl enable --now php8.3-fpmIn Nginx, switch the PHP socket (example) and reload:
fastcgi_pass unix:/run/php/php8.3-fpm.sock;sudo nginx -t && sudo systemctl reload nginxOptional: disable the old FPM once everything works:
sudo systemctl disable --now php8.1-fpm
Tips
- Smoke-test the site after switching — plugins and Laravel may need extra extensions.
- Do not mix several PHP versions on one vhost unless you know which FPM it uses.
ext step
A VPS ready for your PHP stack: Deploy your Cloud VPS.