AWS Amazon EC2 – Install php5.6 in Amazon linux

|
| By Webner

In Amazon Linux, it is not yet packaged with php5.6. When we install PHP by a standrad command:

$yum install php*

1. It will install PHP version 5.3

Below are the steps to update PHP version from 5.3 to 5.6 in Amazon Linux:

Remove OLD Apache Version

$sudo service httpd stop
$sudo yum erase httpd httpd-tools apr apr-util

2. Remove OLD PHP Version:

$sudo yum remove php-*

3. Install PHP 5.6 (Apache 2.4 will be automatically installed with this):

$sudo yum install php56

4. Make sure all the required PHP extensions are installed:

$yum list installed | grep php

5. If required install php extensions using:

$sudo yum install php56-xml php56-xmlrpc php56-soap php56-gd

6. To list other available php extensions:

$yum search php56

7. PHP 5.6 MySQL extension (Assume you have already installed MySQL):

$sudo yum install php56-mysqlnd

8. Start / Restart Apache:

$sudo service httpd start
$sudo service httpd restart

9. Check the version:

$php -v

PHP 5.6.26 (cli) (built: Oct 6 2016 19:48:12)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

$ httpd -v

Server version: Apache/2.4.23 (Amazon)
Server built: Jul 29 2016 21:42:17

Leave a Reply

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