Created
July 1, 2017 17:59
-
-
Save debugsito/721d05402b80e6816b6d4e0ae642b0f1 to your computer and use it in GitHub Desktop.
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
up vote | |
162 | |
down vote | |
accepted | |
Remove all the stock php packages | |
List installed php packages with dpkg -l | grep php| awk '{print $2}' |tr "\n" " " then remove unneeded packages with sudo aptitude purge your_packages_here or if you want to directly remove them all use : | |
sudo apt-get purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "` | |
Add the PPA | |
sudo add-apt-repository ppa:ondrej/php | |
If you get add-apt-repository: command not found run the following command first : | |
sudo apt-get install software-properties-common | |
Install your PHP Version | |
sudo apt-get update | |
sudo apt-get install php5.6 | |
You can install php5.6 modules too for example | |
sudo apt-get install php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml | |
Verify your version | |
If you have installed php5.6-cli | |
sudo php -v | |
If you don't have php5.6-cli, put this on a .php file | |
<?php | |
//outputs php configuration info | |
phpinfo(); | |
?> | |
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
Switch PHP version: | |
From php5.6 to php7.0: | |
Apache: | |
sudo a2dismod php5.6 ; sudo a2enmod php7.0 ; sudo service apache2 restart | |
CLI: | |
sudo update-alternatives --set php /usr/bin/php7.0 | |
From php7.0 to php5.6: | |
Apache: | |
sudo a2dismod php7.0 ; sudo a2enmod php5.6 ; sudo service apache2 restart | |
CLI: | |
sudo update-alternatives --set php /usr/bin/php5.6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment