Skip to content

Instantly share code, notes, and snippets.

@ladyjer
Last active August 1, 2018 20:31
Show Gist options
  • Save ladyjer/5a2da3fcc1da3a5bc7f7 to your computer and use it in GitHub Desktop.
Save ladyjer/5a2da3fcc1da3a5bc7f7 to your computer and use it in GitHub Desktop.
Switch between PHP5 and PHP7 on Linux
sudo service apache2 stop
sudo a2dismod php5
sudo a2enmod php7
sudo service apache2 start
@baardev
Copy link

baardev commented Aug 1, 2018

if you want to switch between 7 and 5 you'll need something like the following to make sure all the libs are in sync

rm /usr/lib/php
ln -fs /usr/lib/php5 /usr/lib/php
rm /etc/php
ln -fs /etc/php5 /etc/php
rm /usr/bin/php
ln -fs /usr/bin/php5 /usr/bin/php
rm /usr/share/php
ln -fs /usr/share/php5 /usr/share/php
a2dismod php7.0
a2enmod php5
service apache2 reload

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment