Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. PHP
  3. Brew PHP Switcher

Brew PHP Switcher

MITShellv2.6

A simple shell script to switch Apache and CLI configurations between major PHP versions for Homebrew users on macOS.

GitHubGitHub
1.0k stars92 forks0 contributors

What is Brew PHP Switcher?

Brew PHP Switcher is a command-line tool that automates switching between different major versions of PHP on macOS systems where PHP is installed via Homebrew. It updates both Apache web server configurations and the command-line PHP version with a single command, solving the problem of manually editing config files when working on multiple projects with incompatible PHP requirements.

Target Audience

PHP developers on macOS who use Homebrew to manage PHP installations and need to frequently switch between different PHP versions for various projects, such as those maintaining legacy applications alongside modern ones.

Value Proposition

Developers choose Brew PHP Switcher because it eliminates the tedious, error-prone process of manually updating Apache and CLI configurations, providing a reliable, scripted solution that ensures consistency and saves time when managing multiple PHP environments.

Overview

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.

Use Cases

Best For

  • Switching PHP versions for Apache web server on macOS
  • Managing CLI PHP versions across different projects
  • Working with legacy PHP applications (5.6, 7.x) and modern ones (8.x)
  • Automating PHP environment configuration for Homebrew users
  • Reducing manual config edits when testing across PHP versions
  • Setting up development environments for multiple PHP-based products

Not Ideal For

  • Developers using operating systems other than macOS, such as Linux or Windows
  • Projects where PHP is installed via methods other than Homebrew, like MacPorts or direct system installation
  • Environments using web servers like Nginx instead of Apache
  • Teams that require running multiple PHP versions simultaneously via virtual hosts or containers

Pros & Cons

Pros

Quick Version Switching

Switches between PHP versions from 5.6 to 8.4 with a single command, automating updates to both Apache and CLI configurations without manual edits.

Apache Integration

Automatically modifies Apache config to use the correct Homebrew PHP module, as detailed in the README's caveats, ensuring seamless web server compatibility.

CLI Synchronization

Updates the command-line PHP version to match the selected version, maintaining consistency across development tools and scripts.

Selective Configuration

Allows skipping or targeting specific configs like Apache or Valet using -s and -c flags, providing flexibility for different setup needs.

Cons

Platform and Tool Lock-in

Only works on macOS with PHP installed via Homebrew, making it useless for cross-platform development or alternative package managers.

Manual Pre-configuration Required

Requires commenting out the native OS X PHP module in Apache config before use, as stated in the caveats, which can be error-prone for newcomers.

Limited Web Server Support

Primarily focuses on Apache; while Valet is supported, other servers like Nginx are not handled, forcing manual adjustments for broader setups.

Frequently Asked Questions

Quick Stats

Stars1,007
Forks92
Contributors0
Open Issues15
Last commit9 days ago
CreatedSince 2014

Tags

#apache#developer-tools#version-management#shell#cli#php#php-versions#homebrew#macos#shell-script

Built With

s
shell

Included in

PHP32.5k
Auto-fetched 16 hours ago

Related Projects

PHP BrewPHP Brew

Brew & manage PHP versions in pure PHP at HOME

Stars5,526
Forks364
Last commit5 months ago
Static PHP CLIStatic PHP CLI

Build standalone portable PHP binaries on Linux, macOS, Windows, with PHP project together, with popular extensions included.

Stars1,912
Forks397
Last commit1 day ago
PHP BuildPHP Build

Builds PHP so that multiple versions can be used side by side.

Stars1,048
Forks158
Last commit18 days ago
HomebrewHomebrew

A package manager for macOS

Stars0
Forks0
Last commit
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub