Select Page

How to update PHP version in Amazon Linux to PHP 5.6

How to update PHP version in Amazon Linux to PHP 5.6

Did you know that each PHP version is fully supported only for two years from its initial stable release? Unsupported versions are vulnerable to security exploits, which is why you need to timely update PHP versions.

In the case of AWS, PHP upgrade should be performed in all server instances that run PHP, for securing them. But the upgrade steps may vary with the OS flavour in that server.

See how our server support team helps you!

What is Amazon Linux?

Amazon Web Services (AWS) provides computing instances to customers. Popularly termed EC2, these instances can be created in various OS flavours such as RHEL, Ubuntu, etc.

One such OS distribution is the Amazon Linux, which is a Linux distribution based on Red Hat Enterprise Linux (RHEL) and CentOS. AWS team offers this Amazon Linux distribution for use in their EC2 instances.

This Amazon Linux distribution is maintained with timely updates and official support from AWS. It also comes with all the required tools for communicating with the API.

As a result, the latest version of PHP – PHP 5.6 package – is only supported in the ‘Amazon Linux’ flavour of EC2 instances, as of now.

Today, we’ll see how to upgrade the version of PHP to 5.6 in Amazon Linux EC2 instances.

1. Take backups

Any software update has its own risk. So, before upgrading PHP and Apache, we first take a backup of the configuration and the settings.

The Apache configuration file ‘httpd.conf’, PHP configuration settings in ‘php.ini’ file, and other custom settings are backed up. These backups are helpful in reverting the services to working condition, if the upgrade fails.

We also take note of the modules or extensions installed and compiled into the web server, in order to restore the websites back to their working state, in case something goes wrong.

[Spending too much time managing your AWS instances? Our expert engineers take care of your infrastructure and ensure its smooth functioning. ]

2. Remove old versions of PHP and Apache

The next step is to remove the instances of old versions of Apache and PHP in the server instance, as these can conflict with the new install. Before removing, it is always important to stop the web server as otherwise it can get corrupted.

sudo service httpd stop
sudo yum remove httpd* php*

3. Update the packages

New versions and patches for software are released often. These packages are usually available in the official repository of the OS, such as ‘yum’ repository for CentOS.

Inorder to benefit from the latest features and security updates of the software,  we keep these packages updated in the server, by getting them from their repository.

Updating packages from the repository helps us ensure that we get the latest secure versions and dependencies. This is done using the commands:

sudo yum clean all
sudo yum update -y


Get your AWS instances updated!

Worried about upgrades and service errors in your servers? Let us help you.

GET IN TOUCH WITH AN EXPERT NOW!


2 Comments

  1. thanks dude, very quick and efficient steps..

    Reply
  2. That was unexpectedly simple. I didn’t know it was that quick to update PHP version on AWS. I was using Cloudways platform to host my PHP app on AWS (https://www.cloudways.com/blog/host-php-on-aws-cloud/ ). So, when it came time to update the version, I only had to select PHP 7 from the dropdown menu and made sure the code was up to date.

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Bobcares
Bobcares is a server management company that helps businesses deliver uninterrupted and secure online services. Our engineers manage close to 51,500 servers that include virtualized servers, cloud infrastructure, physical server clusters, and more.
MORE ABOUT BOBCARES