Homebrew/homebrew-php

Name: homebrew-php

Owner: Homebrew

Description: :elephant: PHP macOS formulae for the Homebrew package manager

Created: 2012-02-19 06:55:28.0

Updated: 2018-01-17 15:12:46.0

Pushed: 2018-01-17 12:00:37.0

Homepage:

Size: 6671

Language: Ruby

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Homebrew PHP

A centralized repository for PHP-related brews.

Requirements
Installation

Run the following in your command-line:

ew tap homebrew/homebrew-php
Bugs happen

The more information you provide and the more detailed your report is, the easier it is for us to fix it. An example of the best practice(s) for filling out bug reports can be seen here: https://github.com/Homebrew/homebrew-php/issues/1225.

Please refer to this section for more information.

Common Issues

Bugs inevitably happen - none of us are running EVERY conceivable setup - but hopefully the install process can be made smoother through the following tips:

 rm freetype jpeg libpng gd zlib
 install freetype jpeg libpng gd zlib

Doing all of these might be a hassle, but will more than likely ensure you either have a working install or get help as soon as possible.

Common upgrade issues

If you have recently upgraded your macOS version or Xcode, you may have some compilation or missing libraries issues. The following information may help you solve most of the problems:

Filing Bug Reports

An example of the best practice(s) for filling out bug reports can be seen here: https://github.com/Homebrew/homebrew-php/issues/1225.

Please include the following information in your bug report:

New bug reports will be created with a template of this information for you to fill in.

This will help us diagnose your issues much quicker, as well as find similarities between different reported issues.

Background

This repository contains PHP-related formulae for Homebrew.

(This replaces the PHP formulae that used to live under adamv's homebrew-alt repository.)

The purpose of this repository is to allow PHP developers to quickly retrieve working, up-to-date formulae. The mainline Homebrew repositories are maintained by non-php developers, so testing/maintaining PHP-related brews has fallen by the wayside. If you are a PHP developer using Homebrew, please contribute to this repository.

Usage

Note: For a list of available configuration options run:

ew options php71

Once the tap is installed, you can install php54, php55, php56, php70, php71, php72, or any formulae you might need via:

ew install php71

That's it!

Please also follow the instructions from brew info at the end of the install to ensure you properly installed your PHP version.

Installing Multiple Versions

Using multiple PHP versions from homebrew-php is pretty straightforward.

If using Apache, you will need to update the LoadModule call. For convenience, simply comment out the old PHP version:

tc/apache2/httpd.conf
apping from PHP 5.5 to PHP 7.1
OMEBREW_PREFIX is normally `/usr/local`
adModule php5_module    $HOMEBREW_PREFIX/Cellar/php55/5.5.18/libexec/apache2/libphp5.so
Module php7_module    $HOMEBREW_PREFIX/Cellar/php71/7.1.11/libexec/apache2/libphp7.so

If using FPM, you will need to unload the plist controlling php, or manually stop the daemon, via your command line:

apping from PHP 5.5 to PHP 7.1
OMEBREW_PREFIX is normally `/usr/local`
 $HOMEBREW_PREFIX/Cellar/php71/7.1.11/homebrew.mxcl.php71.plist ~/Library/LaunchAgents/
unchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.php55.plist
unchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php71.plist

If you would like to swap the PHP you use on the command line, you should update the $PATH variable in either your .profile, .zshrc, .bashrc or .bash_profile:

apping from PHP 7.0 to PHP 7.1
port PATH="$(brew --prefix homebrew/php/php70)/bin:$PATH"
rt PATH="$(brew --prefix homebrew/php/php71)/bin:$PATH"

Please be aware that you must make this type of change EACH time you swap between PHP minor versions. You will typically only need to update the Apache/FPM when upgrading your PHP patch version.

PEAR Extensions

Pear is no longer compiled by default, instead you need to install php with the --with-pear option, such as: brew install php71 --with-pear.

Please note that all extensions installed with the included pear will be installed to the respective php's bin path. For example, supposing you installed PHP_CodeSniffer as follows:

ar install PHP_CodeSniffer

It would be nice to be able to use the phpcs command via command-line, or other utilities. You will need to add the installed php's bin directory to your path. The following would be added to your .bashrc or .bash_profile when running the php71 brew:

rt PATH="$(brew --prefix php71)/bin:$PATH"

Some caveats:

Contributing

See Contributing

Todo
License

See LICENSE.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.