Skip to content

Instantly share code, notes, and snippets.

@osadan
Created January 1, 2023 10:40
Show Gist options
  • Save osadan/5e783a9f9429610f5affbc9aa7cab450 to your computer and use it in GitHub Desktop.
Save osadan/5e783a9f9429610f5affbc9aa7cab450 to your computer and use it in GitHub Desktop.
script to switch between php version apache and cli
#!/bin/bash
echo "changeing from $2 to $4"
a2dismod php$2
a2enmod php$4
systemctl restart apache2
update-alternatives --set php /usr/bin/php$4
update-alternatives --set php /usr/bin/phar$4
update-alternatives --set phar.phar /usr/bin/phar.phar$4
update-alternatives --set phpsize /usr/bin/phpsize$4
update-alternatives --set php-config /usr/bin/php-config
// call it with the versions as parameter
// ./switch-php-version.sh from <current version> to <desired version>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment