Skip to content

Instantly share code, notes, and snippets.

@biplobice
Last active June 14, 2018 05:37
Show Gist options
  • Save biplobice/6112358139b8e1a0c5f944e4b5140bcd to your computer and use it in GitHub Desktop.
Save biplobice/6112358139b8e1a0c5f944e4b5140bcd to your computer and use it in GitHub Desktop.

XCode Command Line Tools

$ xcode-select --install

Homebrew Installation

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew --version
$ brew doctor

Stop Default Apache

$ sudo apachectl stop
$ sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null

Nginx Installation

$ brew install nginx
$ sudo brew services start nginx

PHP Installation

$ brew install php@5.6
$ brew install php@7.0
$ brew install php@7.1
$ brew install php@7.2
$ brew unlink php@7.2 && brew link --force --overwrite php@5.6

I fixed all my migration related issues (regarding the most-current-version 7.2) with:

# Save all old configurations, so the new packaes can recreate their versions -- eases the migration
mv /usr/local/etc/php $HOME/old-brew-php
# Uninstall ALL php related Packages (most of them homebrew/php related)
brew list | grep php | xargs brew uninstall --force
# Remove deprecated tap
brew untap homebrew/php
# Clean cache
brew cleanup
# Ensure latest brew repo HEAD
brew update
# Install latest php (php 7.2)
brew install php
pecl install xdebug
# Now copy & paste specific conf.d from your old-brew-php version if needed
# after that you may dispose of the old-brew-php folder
Older versions may be installed with the @ syntax. e.G. php@7.1 or php@5.6

You also need to add some lines to php.ini or to a file you create in for ex. /usr/local/etc/php/7.1/conf.d/. The lines should look like:

[xdebug]
zend_extension="/usr/local/opt/php/lib/php/<somedir>/xdebug.so"
In my case (php 7.2), I have a file /usr/local/etc/php/7.2/conf.d/ext-xdebug.ini that contains these lines.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment