Thursday, December 26, 2019

Install PHP 7.3 on Amazon AWS Linux 2 instance

Following scenario is outlined below: First will install default PHP that comes with AWS Linux 2 (5.x) then will install by mistake 7.2 and after properly install 7.3. All steps are done using sudo root privilegies:

1. Check the following command to see available php packages available and versions:
yum list available php\*

2. Install PHP:
yum install php

3. Using the below command check installed version of PHP - it shall default to 5.x:
php -v

4. Install php 7.2 using amazon-linux-extras:
amazon-linux-extras install php7.2

5. Now you get proper version:
php -v


6. But wait, you want to install latest version (7.3), how do you do that? It shows enabled only 7.2:
amazon-linux-extras list

7. First, disable 7.2 version:
amazon-linux-extras disable php7.2

8. Enable 7.3:
amazon-linux-extras enable php7.3

9. Install PHP, it shall install 7.3:
yum install php


10. Check version:
php -v

PHP 7.3.11 (cli) (built: Oct 31 2019 19:16:47) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies


Good Job! You are now using the latest and greatest PHP.

No comments:

Post a Comment