Skip to content

Instantly share code, notes, and snippets.

@nazares
Created October 30, 2023 14:48
readme for deb-sphp

Debian-based distributives PHP Switcher

Debian PHP switcher is a simple script to switch your Apache and CLI configs quickly between major versions of PHP. This supports any version of php installed onto the Debian-based system.

If you support multiple products/projects that are built using either brand new or old legacy PHP functionality and you find it a pain to change config files continually this will make the whole process just one command.

Caveats

For use with Debian-based systems. For macOS php switching, I recommend a Phil Cook's php switcher script

Installation

curl -L http://gitlab.sfr.local/nazares/deb-php-switcher/-/raw/main/sphp.sh > /usr/local/bin/sphp
chmod +x /usr/local/bin/sphp

Usage

Simply type sphp and the version you want to switch:

sphp 8.0 #to switch to PHP 8.0 version
sphp 8.1 #to switch to PHP 8.1 version
sphp 8.2 #to switch to PHP 8.2 version
...
etc.

to get installed versions of PHP just run:

sphp
# Please specify a php version to switch to:
# 8.0 8.1 8.2

License

MIT

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