How to install PHP 7.2/7.3/7.4 or 8.0 on Amazon Linux 2

https:‮//‬www.lautturi.com
How to install PHP 7.2/7.3/7.4 or 8.0 on Amazon Linux 2

To install PHP 7.2, 7.3, 7.4, or 8.0 on Amazon Linux 2, you can use the following steps:

  1. Add the repository for PHP 7.2, 7.3, 7.4, or 8.0:
sudo amazon-linux-extras install -y php7.2

Replace php7.2 with php7.3, php7.4, or php8.0 depending on the version you want to install.

  1. Install PHP:
sudo yum install -y php

This will install the latest version of PHP available in the repository.

  1. Restart the Apache web server:
sudo service httpd restart

This will apply the changes and make PHP available to your web server.

  1. Test the installation:

Create a PHP file in the document root of your web server with the following code:

<?php
phpinfo();
?>

Save the file and access it from a web browser. You should see a page with information about your PHP installation, indicating that PHP is working correctly.

Created Time:2017-10-28 21:39:04  Author:lautturi