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

Privacy Preference Center

    Necessary

    Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

    PHPSESSID - Preserves user session state across page requests.

    gdpr[consent_types] - Used to store user consents.

    gdpr[allowed_cookies] - Used to store user allowed cookies.

    PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
    PHPSESSID
    WHMCSpKDlPzh2chML

    Statistics

    Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

    _ga - Preserves user session state across page requests.

    _gat - Used by Google Analytics to throttle request rate

    _gid - Registers a unique ID that is used to generate statistical data on how you use the website.

    smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

    _ga, _gat, _gid
    _ga, _gat, _gid
    smartlookCookie

    Marketing

    Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

    IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

    test_cookie - Used to check if the user's browser supports cookies.

    1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

    NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

    DV - Google ad personalisation

    IDE, test_cookie, 1P_JAR, NID, DV, NID
    IDE, test_cookie
    1P_JAR, NID, DV
    NID