Skip to content

Instantly share code, notes, and snippets.

@bobthecow
Last active January 7, 2020 02:50
Star You must be signed in to star a gist
Save bobthecow/85ad6dfb594d9215b42b to your computer and use it in GitHub Desktop.
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
brew install php56
# Fix PEAR permissions
chmod -R ug+w `brew --prefix php56`/lib/php
pear config-set php_ini /usr/local/etc/php/5.6/php.ini
# Fix PEAR config and upgrade
pear config-set auto_discover 1
pear update-channels
pear upgrade
# Install PHP extensions
# You might want some more. Use `brew search php56` to see what's available.
brew install php56-mongo php56-memcache
# You'll want Composer
brew install composer
# Install some important Composer packages globally
composer global require phpunit/phpunit:~4.2
composer global require squizlabs/php_codesniffer:~1.5
composer global require fabpot/php-cs-fixer:~0.5
composer global require psy/psysh:~0.1
# Make sure to add Composer's `bin` directory to your $PATH
# … or none of these will work.
# Set "PSR-2" as your default coding standard
phpcs --config-set default_standard PSR2
@jeffstumpf1
Copy link

This script saved me in installing symfony!

@brettalton
Copy link

Why do you install php56 and then install php54-* extensions?

@bobthecow
Copy link
Author

@brettalton copypasta. It's fixed now :)

@grantgeorge
Copy link

you're the man! Thank you

@marcandreappel
Copy link

Super! As I'm new to Mac and Homebrew, that helped me a lot, thank you!

@rockymontana
Copy link

Error: Unable to guess PHP branch for Formulary::Formulae::Php56Apcu

when I try to install any extensions (just switch Php56Apcu to other package name). 😢

@zx1986
Copy link

zx1986 commented Apr 13, 2015

太棒了!萬分感謝!

@df365
Copy link

df365 commented Dec 25, 2015

Got the following after 'brew install php56':

Error: undefined method desc' for Formulary::Formulae::Php56:Class Please report this bug: https://git.io/brew-troubleshooting /usr/local/Library/Taps/homebrew/homebrew-php/Formula/php56.rb:5:inclass:Php56'
/usr/local/Library/Taps/homebrew/homebrew-php/Formula/php56.rb:3:in load_file' /usr/local/Library/Homebrew/formulary.rb:92:inmodule_eval'
/usr/local/Library/Homebrew/formulary.rb:92:in load_file' /usr/local/Library/Homebrew/formulary.rb:82:inklass'
/usr/local/Library/Homebrew/formulary.rb:71:in get_formula' /usr/local/Library/Homebrew/formulary.rb:200:infactory'
/usr/local/Library/Homebrew/extend/ARGV.rb:16:in block in formulae' /usr/local/Library/Homebrew/extend/ARGV.rb:16:inmap'
/usr/local/Library/Homebrew/extend/ARGV.rb:16:in formulae' /usr/local/Library/Homebrew/cmd/install.rb:41:ininstall'
/usr/local/Library/brew.rb:135:in `

'

@tomsihap
Copy link

This is awesome!
Some issues :

first issue
$ composer global require fabpot/php-cs-fixer:~0.5
Changed current directory to /Users/tomsihap/.composer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- fabpot/php-cs-fixer v0.5.0 requires sebastian/diff 1.1.* -> satisfiable by sebastian/diff[1.1.0].
- fabpot/php-cs-fixer v0.5.1 requires sebastian/diff 1.1.* -> satisfiable by sebastian/diff[1.1.0].
- fabpot/php-cs-fixer v0.5.2 requires sebastian/diff 1.1.* -> satisfiable by sebastian/diff[1.1.0].
- fabpot/php-cs-fixer v0.5.3 requires sebastian/diff 1.1.* -> satisfiable by sebastian/diff[1.1.0].
- fabpot/php-cs-fixer v0.5.4 requires sebastian/diff 1.1.* -> satisfiable by sebastian/diff[1.1.0].
- fabpot/php-cs-fixer v0.5.5 requires sebastian/diff 1.1.* -> satisfiable by sebastian/diff[1.1.0].
- fabpot/php-cs-fixer v0.5.6 requires sebastian/diff 1.1.* -> satisfiable by sebastian/diff[1.1.0].
- fabpot/php-cs-fixer v0.5.7 requires sebastian/diff 1.1.* -> satisfiable by sebastian/diff[1.1.0].
- Conclusion: don't install sebastian/diff 1.1.0
- Installation request for fabpot/php-cs-fixer ~0.5 -> satisfiable by fabpot/php-cs-fixer[v0.5.0, v0.5.1, v0.5.2, v0.5.3, v0.5.4, v0.5.5, v0.5.6, v0.5.7].

Installation failed, reverting ./composer.json to its original content.

Second issue
$ phpcs --config-set default_standard PSR2
zsh: command not found: phpcs

@franz-josef-kaiser
Copy link

This will probably need PEAR to be installed: brew install php56 --with-pear. To remove outdated packages, use brew cleanup.

@universe416
Copy link

Thank you !!!!

@vikramsurya
Copy link

Error below -- any help?

composer global require fabpot/php-cs-fixer:~0.5
returns:
Changed current directory to /Users/vikram/.composer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- fabpot/php-cs-fixer v0.5.0 requires sebastian/diff 1.1.* -> satisfiable by sebastian/diff[1.1.0].
- fabpot/php-cs-fixer v0.5.1 requires sebastian/diff 1.1.* -> satisfiable by sebastian/diff[1.1.0].
- fabpot/php-cs-fixer v0.5.2 requires sebastian/diff 1.1.* -> satisfiable by sebastian/diff[1.1.0].
- fabpot/php-cs-fixer v0.5.3 requires sebastian/diff 1.1.* -> satisfiable by sebastian/diff[1.1.0].
- fabpot/php-cs-fixer v0.5.4 requires sebastian/diff 1.1.* -> satisfiable by sebastian/diff[1.1.0].
- fabpot/php-cs-fixer v0.5.5 requires sebastian/diff 1.1.* -> satisfiable by sebastian/diff[1.1.0].
- fabpot/php-cs-fixer v0.5.6 requires sebastian/diff 1.1.* -> satisfiable by sebastian/diff[1.1.0].
- fabpot/php-cs-fixer v0.5.7 requires sebastian/diff 1.1.* -> satisfiable by sebastian/diff[1.1.0].
- Conclusion: don't install sebastian/diff 1.1.0
- Installation request for fabpot/php-cs-fixer ~0.5 -> satisfiable by fabpot/php-cs-fixer[v0.5.0, v0.5.1, v0.5.2, v0.5.3, v0.5.4, v0.5.5, v0.5.6, v0.5.7].

Installation failed, reverting ./composer.json to its original content.


@vukanac
Copy link

vukanac commented Aug 20, 2017

brew tap homebrew/dupes
brew tap homebrew/versions

Warning: homebrew/dupes was deprecated. This tap is now empty as all its formulae were migrated.
Warning: homebrew/versions was deprecated. This tap is now empty as all its formulae were migrated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment