The package manager for macOS and Linux that installs command-line tools and GUI apps from its formula and cask repositories.
shivammathur/homebrew-php
A Homebrew tap that provides formulae for installing multiple PHP versions (5.6 to 8.7) on macOS and Linux.
- Stars
- 2,876
- Forks
- 183
- Open issues
- 1
- Last commit
- 2 days ago
What is it?
This Homebrew tap lets developers install specific PHP versions from 5.6 through 8.7 with brew instead of relying on the system PHP. Each version comes in several variants: a standard build, a debug build for working on PHP extensions, a thread-safe (ZTS) build for multi-threaded applications, and a debug ZTS build combining both. PHP 8.6 and 8.7 are built nightly.
The formulae target Linux on x86_64 and arm64, and macOS on Apple silicon (Sequoia, Tahoe and Golden Gate). Intel Macs are not supported. Installation is a brew install followed by a brew link, and switching between versions is done by relinking. The debug builds are intended for extension development and are not recommended for production.
The project is maintained by the author of setup-php and is related to a companion tap for PHP extensions.
Key features
- 01Provides PHP formulae from 5.6 through 8.7 installable via brew.
- 02Offers standard, debug, thread-safe (ZTS) and debug-ZTS variants for each version.
- 03Supports Linux (x86_64, arm64) and macOS on Apple silicon.
- 04Switches between installed PHP versions by relinking.
- 05PHP 8.6 and 8.7 are built nightly.
Use cases
- Running a specific PHP version on a Mac to match a production environment.
- Testing an application against several PHP releases during an upgrade.
- Building or debugging PHP extensions with the debug formulae.
- Using a thread-safe PHP build for multi-threaded applications.
Quick start
- 1
Install Xcode Command Line Utilities on macOS
xcode-select --install - 2
Install Homebrew using the official install script from the README
- 3
Add the tap and mark it trusted
brew tap shivammathur/php brew trust shivammathur/php - 4
Install PHP 8.5 and link it
brew install shivammathur/php/php@8.5 brew link --overwrite --force shivammathur/php/php@8.5
Things to know
- macOS Intel is not supported; only Apple arm64 on macOS.
- Debug formulae are not recommended for production use.
In collections
Topics
FAQ
- What is homebrew-php?
- A Homebrew tap that provides formulae for installing multiple PHP versions (5.6 to 8.7) on macOS and Linux. This Homebrew tap lets developers install specific PHP versions from 5.6 through 8.7 with brew instead of relying on the system PHP. Each version comes in several variants: a standard build, a debug build for working on PHP extensions, a thread-safe (ZTS) build for multi-threaded applications, and a debug ZTS build combining both. PHP 8.6 and 8.7 are built nightly.
- Is homebrew-php free to use? What license does it have?
- homebrew-php is open source under the MIT license. Check the license terms before using it in commercial products.
- Is homebrew-php still maintained?
- Actively maintained. The last commit to homebrew-php was on Nov 5, 2026.
- What can I use homebrew-php for?
- Running a specific PHP version on a Mac to match a production environment. Testing an application against several PHP releases during an upgrade. Building or debugging PHP extensions with the debug formulae. Using a thread-safe PHP build for multi-threaded applications.
- How do I install homebrew-php?
- Install Xcode Command Line Utilities on macOS: xcode-select --install Install Homebrew using the official install script from the README Add the tap and mark it trusted: brew tap shivammathur/php brew trust shivammathur/php Install PHP 8.5 and link it: brew install shivammathur/php/php@8.5 brew link --overwrite --force shivammathur/php/php@8.5
- Where can I get homebrew-php?
- The source code and installation instructions are on GitHub: https://github.com/shivammathur/homebrew-php
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
Shell scripts that install and uninstall the Homebrew package manager on macOS and Linux.
Homebrew's default collection of cask definitions for installing prebuilt GUI apps, CLI tools and fonts from upstream vendors via the brew CLI.
A fast macOS GUI for Homebrew, built with SwiftUI, for browsing, installing, updating and maintaining packages and casks.
A native macOS GUI for Homebrew to install, update, and manage formulae, casks, taps, and services without the terminal.
Homebrew's official native macOS app for discovering, installing, updating and managing Homebrew packages without using Terminal.