Skip to content
Brew PHP switcher is a simple shell script to switch your apache and CLI quickly between major versions of PHP. If you support multiple products/projects that are built using either brand new or old legacy PHP functionality. For users of Homebrew (or brew for short) currently only.
Shell
Branch: master
Clone or download

Latest commit

pgrimaud and ikari7789 Add support for PHP 7.4 (#66)
* Add support for PHP 7.4

* Update README.md

* Remove php 5.6 and 7.1 from tests

* Remove php 5.6 and 7.1 from clean script

* Remove php 5.6 and 7.1 from travis setup
Latest commit 963f245 Dec 4, 2019

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.travis Add support for PHP 7.4 (#66) Dec 4, 2019
.gitignore Add travis ci testing, simply the start of messing with this. Jul 30, 2016
.travis.yml Add support for PHP 7.4 (#66) Dec 4, 2019
LICENSE Initial commit Mar 12, 2014
README.md Add support for PHP 7.4 (#66) Dec 4, 2019
_config.yml Set theme jekyll-theme-minimal Apr 27, 2017
phpswitch.sh Add support for PHP 7.4 (#66) Dec 4, 2019

README.md

Brew PHP Switcher Build Status

Brew PHP switcher is a simple script to switch your Apache and CLI configs quickly between major versions of PHP.

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 users of OSX only who have installed PHP via Homebrew and for PHP version 5.6, 7.0, 7.1, 7.2, 7.3 and 7.4 only.

Your Apache config must have native osx PHP module commented out.

#LoadModule php5_module libexec/apache2/libphp5.so

Brew PHP Switcher will automatically add the Homebrew's PHP module location in the Apache config in the following format.

#LoadModule php5_module /usr/local/opt/php@5.6/lib/httpd/modules/libphp5.so
#LoadModule php7_module /usr/local/opt/php@7.0/lib/httpd/modules/libphp7.so
#LoadModule php7_module /usr/local/opt/php@7.1/lib/httpd/modules/libphp7.so
#LoadModule php7_module /usr/local/opt/php@7.2/lib/httpd/modules/libphp7.so
#LoadModule php7_module /usr/local/opt/php@7.3/lib/httpd/modules/libphp7.so
#LoadModule php7_module /usr/local/opt/php@7.4/lib/httpd/modules/libphp7.so

Version

2.1

Installation

brew install brew-php-switcher

Where 5.6 exists, please replace with syntax of 5.6, 7.0, 7.1, 7.2, 7.3, or 7.4 depending on which version is required.

brew-php-switcher 5.6

by default will switch apache config

Options

  • -s|-s=* Skips apache & valet config switch for i.e
# skip apache only
brew-php-switcher 5.6 -s

# skip valet only
brew-php-switcher 5.6 -s=valet

# skip valet & apache
brew-php-switcher 5.6 -s=valet,apache
  • -c=* switch a specific config for i.e
# switch valet config only
brew-php-switcher 5.6 -c=valet

# switch valet & apache config only
brew-php-switcher 5.6 -c=valet,apache

# switch apache config only
brew-php-switcher 5.6 -c=apache

License

MIT

You can’t perform that action at this time.