When you spin up a new instance on AWS Lightsail and use the LAMP stack the PHP version is 5.6. Booooo
The only way to update PHP is to upgrade the LAMP stack through Bitnami.
Follow these steps:
- Access the machine using SSH. This will log you into /home/bitnami.
- Create a backup of the database if you have information there
https://docs.bitnami.com/aws/components/mysql/#how-to-create-a-database-backup4
- Stop the current services and move the current installation folder
sudo /opt/bitnami/ctlscript.sh stop sudo mv /opt/bitnami /opt/bitnami.back
Get the latest version url from this link. Right click on the link and “copy link as”. Subsitute that link for the one below in the wget line.
wget "https://bitnami.com/redirect/to/237356/bitnami-lampstack-7.1.19-0-linux-x64-installer.run" chmod +x ./bitnami-lampstack-7.1.16-0-linux-x64-installer.run sudo ./bitnami-lampstack-7.1.16-0-linux-x64-installer.run
- Install this stack at
/opt/bitnami
and set your preferred password - Restore the database backup if you created it before
https://docs.bitnami.com/aws/components/mysql/#how-to-restore-a-database-backup
- Migrate your php files and any configuration change you made from the old installation
/opt/bitnami.back
to the new one/opt/bitnami
- Restart Apache (if you modified the default configuration)
sudo /opt/bitnami/ctlscript.sh restart apache
- Check that everything works as expected
Original source