To update PHP on a DigitalOcean droplet, follow these steps:
- SSH into your droplet using your preferred SSH client.
- Once you are logged in to your droplet, run the following command to update the package list:
sudo apt-get update
- Run the following command to upgrade the installed packages, including PHP:
sudo apt-get upgrade
- Follow the prompts and wait for the package upgrade process to complete. This may take some time depending on the number of packages being upgraded.
- Verify that the PHP version has been updated by running the following command:
php -v
- Check that your web server (such as Apache or Nginx) is configured to use the new version of PHP. This will depend on your specific configuration and setup.
That’s it! PHP on your DigitalOcean droplet has been updated.