How to Install PHP 7 on Ec2 T2.Micro Instance Running Amazon Linux Distro

How to install PHP 7.1 on EC2 running on Amazon Linux AMI 2018.03 having nginx as web server?

I followed below steps to install PHP7.1 which had already Nginx as web server for Amazon Linux AMI 2018.03

#Remove Old PHP
yum remove php*

#Update Reposistory
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

#Update Amazon AMI
yum upgrade -y

#Install PHP
#List of PHP packages https://webtatic.com/packages/php71/

yum install php71w php71w-cli php71w-fpm
yum install php71w-mysql php71w-xml php71w-curl
yum install php71w-opcache php71w-pdo php71w-gd
yum install php71w-pecl-apcu php71w-mbstring php71w-imap
yum install php71w-pecl-redis php71w-mcrypt

#change listen mode to CGI
sed -i 's/127.0.0.1:9000/\/tmp\/php5-fpm.sock/g' /etc/php-fpm.d/www.conf

/etc/init.d/php-fpm restart
touch /tmp/php5-fpm.sock
chmod 777 /tmp/php5-fpm.sock
service nginx restart

The reason I am still using /tmp/php5-fpm.sock file so that I do not need to change PHP7 sock file in all website nginx conf and assuming server do not have PHP5 as as on first step it has been removed.

Upgrade PHP on AWS Linux

FINALLY! Seems the instructions on virtually every site I have looked at did not work. What did work was the following:

sudo yum install php71-fpm

I dont understand the difference between php71 and php71-fpm but using the latter seems to install the service and other files I needed. Not everything on my site is working though, as I now need to track down the various php components that are needed. It seems that the various php modules have changed name in assorted ways. For example, php71-pdo exists but php71-mysql does not.

Locally install php Composer.phar in AMAZON Linux AMD

Before running the php command, run the following

yum remove -y php56-pgsql
yum install postgresql-libs postgresql9-contrib

If you need to use php-pgsql you can now reinstall

yum install php56-pgsql

How to install GearmanManager on Amazon AMI EC2 Micro Instance?

To resolve this I opted for another Linux instance

how do I edit the php ini file on aws server

Its actually easier to create an .htaccess file and place it in the root directory of your EC2 instance. filling the file with the values you need like this.

php_value upload_max_filesize 3000M
php_value post_max_size 3000M
php_value memory_limit 3000M

this keeps you from directly editing php's configuration directly and makes it much easier to maintain.



Related Topics



Leave a reply



Submit