PHP 7 on AMI Linux (EC2)

PHP 7 on AMI Linux (EC2)

PHP 7.0 it’s already a while on the market. Let’s install it on EC2 instance.  Here you can find a quick recipe:


sudo yum upgrade -y
sudo yum install php70
php -v
PHP 7.0.21 (cli) (built: Sep 14 2017 15:46:42) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies

Moving forward with Apache configuration if you are looking to use PHP on your server instead of command line online, you have to install additional packages. So if you are using PHP as an FPM module:


then you can just follow instructions in my previous article .

It’s worthwhile to install some additional PHP packages:

yum install php70-xml php70-pdo php70-mysqlnd php70-gd php70-mbstring php70-mcrypt php70-mysqlnd php70-opcache

Let’s make sure that apache is always on:

sudo chkconfig --levels 235 httpd on

Basic PHP configuration:

date.timezone = "Australia/Sydney"
expose_php = Off

Server configuration

cd /etc/
sudo rm -rf localtime && sudo ln -s /usr/share/zoneinfo/Australia/Sydney localtime