Created
November 20, 2018 05:23
-
-
Save imanilchaudhari/a229b62312224de5b2098517ca97e435 to your computer and use it in GitHub Desktop.
PHP Version Manager On Ubuntu 18.04
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get the information of PHP | |
========================== | |
$ sudo apt show php | |
OR | |
$ sudo apt show php -a | |
$ sudo apt install php // this will install default php version ( may be 7.2 ) | |
T0 Install Different Versions Of PHP | |
==================================== | |
$ sudo apt install python-software-properties | |
$ sudo add-apt-repository ppa:ondrej/php | |
$ sudo apt-get update | |
For Apache | |
========== | |
$ sudo apt install php5.6 [PHP 5.6] | |
$ sudo apt install php7.2 [PHP 7.2] | |
For Nginx | |
========= | |
$ sudo apt install php5.6-fpm [PHP 5.6] | |
$ sudo apt install php7.2-fpm [PHP 7.2] | |
To Install Required Modules | |
=========================== | |
$ sudo apt install php5.6-cli php5.6-xml php5.6-mysql ... | |
$ sudo apt install php7.2-cli php7.2-xml php7.2-mysql ... | |
Set Default PHP Version in Ubuntu (i.e. from 7.2 to 5.6) | |
======================================================== | |
$ sudo update-alternatives --set php /usr/bin/php5.6 | |
$ sudo a2dismod php7.2 | |
$ sudo a2enmod php5.6 | |
$ sudo systemctl restart apache2 | |
And so on |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment