Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install any php extension in AWS Amazon Linux AMI?

Today I was stuck at the point where I was trying to install php-tidy to AWS Ami Linux.

It took 4 hours to install me a right version of extension to AWS EC2. So it's really painful for everyone if it takes a long time to install just a simple extension. So I finally found few command lines to install any supported aws php extension to working states.

Check below answer

like image 354
Sahil Patel Avatar asked Feb 13 '20 08:02

Sahil Patel


1 Answers

First Login to Putty | SSH

Use sudo yum command in case it ask for super admin permission.

  1. yum list | grep tidy : as I was trying to install tidy extension so I searched for tidy. you can change it to any extension name. Below will be output for above command

php-tidy.x86_64 5.3.29-1.8.amzn1 amzn-main php54-tidy.x86_64 5.4.45-1.75.amzn1 amzn-main php55-tidy.x86_64 5.5.38-2.119.amzn1 amzn-main php56-tidy.x86_64 5.6.40-1.142.amzn1 amzn-updates php70-tidy.x86_64 7.0.33-1.32.amzn1 amzn-updates php71-tidy.x86_64 7.1.29-1.39.amzn1 amzn-updates php73-tidy.x86_64 7.3.5-1.15.amzn1 amzn-updates tidy.x86_64 0.99.0-19.20070615.1.4.amzn1 amzn-main tidyp.x86_64 1.02-9.2.amzn1 amzn-main

  1. sudo yum list installed | grep php : This command will help us to know which version we need to install from php56, php70, php72, Output will be below:

php7-pear.noarch 1:1.10.7-3.28.amzn1 @amzn-updates php72.x86_64 7.2.18-1.13.amzn1 @amzn-updates php72-bcmath.x86_64 7.2.18-1.13.amzn1 @amzn-updates php72-cli.x86_64 7.2.18-1.13.amzn1 @amzn-updates php72-common.x86_64 7.2.18-1.13.amzn1 @amzn-updates php72-devel.x86_64 7.2.18-1.13.amzn1 @amzn-updates php72-gd.x86_64 7.2.18-1.13.amzn1 @amzn-updates php72-intl.x86_64 7.2.18-1.13.amzn1 @amzn-updates php72-json.x86_64 7.2.18-1.13.amzn1 @amzn-updates php72-mbstring.x86_64 7.2.18-1.13.amzn1 @amzn-updates php72-mysqlnd.x86_64 7.2.18-1.13.amzn1 @amzn-updates php72-odbc.x86_64 7.2.18-1.13.amzn1 @amzn-updates php72-opcache.x86_64 7.2.18-1.13.amzn1 @amzn-updates php72-pdo.x86_64 7.2.18-1.13.amzn1 @amzn-updates php72-pecl-apcu.x86_64 5.1.8-2.7.amzn1 @amzn-updates php72-pecl-igbinary.x86_64 1.2.2-0.1.20151217git2b7c703.8.amzn1 php72-pecl-imagick.x86_64 3.4.3-1.8.amzn1 @amzn-updates php72-pecl-mcrypt.x86_64 1.0.1-3.5.amzn1 @amzn-updates php72-pecl-memcache.x86_64 3.0.9-0.4.20160311git4991c2f.11.amzn1 php72-pecl-memcached.x86_64 3.0.4-1.6.amzn1 @amzn-updates php72-pecl-oauth.x86_64 2.0.2-1.5.amzn1 @amzn-updates php72-pecl-ssh2.x86_64 1.0-5.19.amzn1 @amzn-updates php72-pecl-uuid.x86_64 1.0.4-7.3.amzn1 @amzn-updates php72-pgsql.x86_64 7.2.18-1.13.amzn1 @amzn-updates php72-process.x86_64 7.2.18-1.13.amzn1 @amzn-updates php72-soap.x86_64 7.2.18-1.13.amzn1 @amzn-updates php72-tidy.x86_64 7.2.18-1.13.amzn1 @amzn-updates php72-xml.x86_64 7.2.18-1.13.amzn1 @amzn-updates php72-xmlrpc.x86_64 7.2.18-1.13.amzn1 @amzn-updates It clearly says we need php72-extenstionname

  1. sudo yum install php72-tidy.x86_64 : this is last command to install this particular extension.

Hope I have saved your 3-4 hours to find out solution.

Thanks

like image 194
Sahil Patel Avatar answered Nov 02 '22 22:11

Sahil Patel