Home

Awesome

<p align="center"> <a href="https://github.com/shivammathur/homebrew-php" target="_blank"> <img src="https://repository-images.githubusercontent.com/229187949/f140f880-4c25-11eb-8105-aefec9dc7c66" alt="Homebrew Tap for PHP" width="560"> </a> </p> <h1 align="center">brew tap shivammathur/php</h1> <p align="center"> <a href="https://github.com/shivammathur/homebrew-php" title="Homebrew tap to install PHP: Builds"> <img alt="Build status" src="https://github.com/shivammathur/homebrew-php/workflows/Update%20and%20Build%20Formulae/badge.svg"> </a> <a href="https://github.com/shivammathur/homebrew-php" title="Homebrew tap to install PHP: Tests"> <img alt="Test status" src="https://github.com/shivammathur/homebrew-php/actions/workflows/test.yml/badge.svg"> </a> <a href="https://github.com/shivammathur/homebrew-php/blob/master/LICENSE" title="license"> <img alt="LICENSE" src="https://img.shields.io/badge/license-MIT-428f7e.svg?logo=open%20source%20initiative&logoColor=white&labelColor=555555"> </a> <a href="https://github.com/shivammathur/homebrew-php/tree/master/Formula" title="Formulae for PHP versions"> <img alt="PHP Versions Supported" src="https://img.shields.io/badge/php-5.6%20to%208.5-777bb3.svg?logo=php&logoColor=white&labelColor=555555"> </a> </p> <p align="center"> <a href="https://github.com/shivammathur/homebrew-php#os-support" title="Linux x86_64 supported"> <img alt="Linux architectures supported" src="https://img.shields.io/badge/Linux-x86__64%20-f6ab01?logo=linux&logoColor=555555&labelColor=ffffff"> </a> <a href="https://github.com/shivammathur/homebrew-php#os-support" title="Apple Intel x86_64 supported"> <img alt="macOS architectures supported" src="https://img.shields.io/badge/macOS-Intel%20x86__64%20-007DC3?logo=apple&logoColor=555555&labelColor=ffffff"> </a> <a href="https://github.com/shivammathur/homebrew-php#os-support" title="Apple M1 arm64 supported"> <img alt="macOS architectures supported" src="https://img.shields.io/badge/macOS-Apple%20arm64%20-c0476d?logo=apple&logoColor=555555&labelColor=ffffff"> </a> </p>

PHP Support

PHP VersionNTS FormulaDebug FormulaZTS FormulaDebug ZTS Formula
PHP 5.6php@5.6php@5.6-debugphp@5.6-ztsphp@5.6-debug-zts
PHP 7.0php@7.0php@7.0-debugphp@7.0-ztsphp@7.0-debug-zts
PHP 7.1php@7.1php@7.1-debugphp@7.1-ztsphp@7.1-debug-zts
PHP 7.2php@7.2php@7.2-debugphp@7.2-ztsphp@7.2-debug-zts
PHP 7.3php@7.3php@7.3-debugphp@7.3-ztsphp@7.3-debug-zts
PHP 7.4php@7.4php@7.4-debugphp@7.4-ztsphp@7.4-debug-zts
PHP 8.0php@8.0php@8.0-debugphp@8.0-ztsphp@8.0-debug-zts
PHP 8.1php@8.1php@8.1-debugphp@8.1-ztsphp@8.1-debug-zts
PHP 8.2php@8.2php@8.2-debugphp@8.2-ztsphp@8.2-debug-zts
PHP 8.3php@8.3php@8.3-debugphp@8.3-ztsphp@8.3-debug-zts
PHP 8.4php or php@8.4php-debug or php@8.4-debugphp-zts or php@8.4-ztsphp-debug-zts or php@8.4-debug-zts
PHP 8.5.0-devphp@8.5php@8.5-debugphp@8.5-ztsphp@8.5-debug-zts

For each PHP version, we have formulae with thread-safety support (zts) and debug symbols support (debug) and both (debug-zts) as well. The formulae with debug symbols can be used when building or debugging PHP extensions and are not recommended for production usage. The formulae with thread-safety support can be used with applications that require multi-threading support.

OS Support

Operating SystemArchitecture
Linuxx86_64
macOS Venturax86_64, arm64
macOS Sonomax86_64, arm64
macOS Sequoiax86_64, arm64

Usage

Prerequisites

xcode-select --install
# Using APT
sudo apt-get install -y curl git

# Using Yum
sudo yum install -y curl git
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew update

Add this tap

Fetch the formulae in this tap:

brew tap shivammathur/php

Install PHP

See PHP Support for available formulae.

brew install shivammathur/php/php@8.4
brew link --overwrite --force shivammathur/php/php@8.4
php -v

Upgrade your PHP version

You can upgrade your PHP version to the latest patch release.

For example, to upgrade PHP 8.4:

brew upgrade shivammathur/php/php@8.4

Switch between PHP versions

For example, to switch to PHP 8.4:

brew link --overwrite --force shivammathur/php/php@8.4
Warning: Already linked: <Cellar Path>
To relink:
  brew unlink <formula> && brew link <formula>
brew unlink php@8.4
brew link --overwrite --force shivammathur/php/php@8.4

Restart your webserver

If you are using Apache or Nginx with php-fpm, restart your webserver after any change in your PHP.

brew services restart httpd
brew services restart nginx

Debugging

sudo chown -R "$(id -un)":"$(id -gn)" $(brew --prefix)

For example to reinstall PHP 8.4 and its dependencies:

brew reinstall $(brew deps shivammathur/php/php@8.4) shivammathur/php/php@8.4

License

The code in this project is licensed under the MIT license. Please see the license file for more information.

This project has some dependencies, and their license can be found here.

Contributions

Contributions are welcome! Please see Contributor's Guide before you start. If you face any issues while using this tap or want to suggest a feature/improvement, create an discussion thread here.

Sponsors

In addition to GitHub Actions, we use MacStadium for our CI infrastructure.

<a href="https://www.macstadium.com/opensource/members#gh-light-mode-only"> <img src="https://setup-php.com/sponsors/macstadium.png" alt="Mac Stadium" width="200px"> </a> <a href="https://www.macstadium.com/opensource/members#gh-dark-mode-only"> <img src="https://setup-php.com/sponsors/macstadium-white.png" alt="Mac Stadium" width="200px"> </a>

This project is generously supported by many other users and organisations via GitHub Sponsors.

<a href="https://github.com/sponsors/shivammathur"><img src="https://setup-php.com/sponsors.svg?" alt="Sponsor shivammathur"></a>

Related Projects

Dependencies