How To Install php.x86_64 on Amazon Linux 2

In this tutorial we learn how to install php.x86_64 in Amazon Linux 2. php.x86_64 is PHP scripting language for creating dynamic web sites

Introduction

In this tutorial we learn how to install php.x86_64 on Amazon Linux 2.

What is php.x86_64

PHP is an HTML-embedded scripting language. PHP attempts to make it easy for developers to write dynamically generated web pages. PHP also offers built-in database integration for several commercial and non-commercial database management systems, so writing a database-enabled webpage with PHP is fairly simple. The most common use of PHP coding is probably as a replacement for CGI scripts. The php package contains the module (often referred to as mod_php) which adds support for the PHP language to Apache HTTP Server.

We can use yum to install php.x86_64 on Amazon Linux 2. In this tutorial we discuss both methods but you only need to choose one of method to install php.x86_64.

Install php.x86_64 on Amazon Linux 2 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

After updating yum database, We can install php.x86_64 using yum by running the following command:

sudo yum -y install php.x86_64

How To Uninstall php.x86_64 on Amazon Linux 2

To uninstall only the php.x86_64 package we can use the following command:

sudo yum remove php.x86_64

php.x86_64 Package Contents on Amazon Linux 2

/etc/httpd/conf.d/php.conf
/etc/httpd/conf.modules.d/10-php.conf
/usr/lib64/httpd/modules/libphp5.so
/usr/share/httpd/icons/php.gif
/var/lib/php/session

References

Summary

In this tutorial we learn how to install php.x86_64 on Amazon Linux 2 using yum.