I want to install the latest PHP 7.0 on an AWS EC2 T2.Micro Instance. So far I have read that currently AWS do not support PHP 7. But hey.. This is just a virtual server in the cloud with me having the full control over its configuration, so there must be some way to get PHP 7 running on this one.
Any help much appreciated.
My box is as below
$ cat /etc/*-release
---------------------------------------
NAME="Amazon Linux AMI"
VERSION="2015.09"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2015.09"
PRETTY_NAME="Amazon Linux AMI 2015.09"
ANSI_COLOR="0;33"
CPE_NAME="[*not significant*]"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"
Amazon Linux AMI release 2015.09
$ uname -a
---------------------------------------
Linux ip-xxx-xxx-xxx-xxx 4.1.13-18.26.amzn1.x86_64 #1 [date] x86_64 x86_64 x86_64 GNU/Linux
$ uname -mrs
---------------------------------------
Linux 4.1.13-18.26.amzn1.x86_64 x86_64
$ cat /proc/version
---------------------------------------
Linux version 4.1.13-18.26.amzn1.x86_64 (mockbuild@gobi-build-64010) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) )
Current answer to problem (not original version in question) - worth knowing since this is a bit simpler and php7 isn't available in the standard repos for Amazon Linux 2, and this didn't come up until I searched a bit harder:
The version of extras can be checked with a list command if v7.2 is no longer current:
If you want a quick copy-paste install:
Test with:
And if you want the executable to be
php
:This thread helped me get close enough to finish it off, I'm sharing the commands and output that worked for me.
On Amazon Lightsail with Amazon Linux (amzn1.x86_64), the following command list helped me rid the system of Apache 2.2 and PHP 5.3 to get to Apache 2.4 and PHP:
conf
andconf.d
folder before doing this, imho; in my case, it was a new system setup so there was nothing of interest there):I got this running on my instance. You need http2.2 for it to work with the webtatic repo. I had so many repos there were a bunch of different version incompatibilities. I didn't keep great notes but looking at my history I basically did this:
There are now official php7 packages for aws linux as of July 14, 2016. See the announcement at https://forums.aws.amazon.com/ann.jspa?annID=3902
It's simple. Just: