Skip to content

Instantly share code, notes, and snippets.

@olivertappin
Last active June 22, 2016 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olivertappin/5dfb920ef0deb24fd11f4849e07eef44 to your computer and use it in GitHub Desktop.
Save olivertappin/5dfb920ef0deb24fd11f4849e07eef44 to your computer and use it in GitHub Desktop.
Updating PHP 5.5 to PHP 5.6 in Homebrew
# Unlink your existing php installation
brew unlink php55
# Install the version you need
brew install php56
# Check for errors
# If you get: "Error: Directory not empty - /usr/local/opt/php56"
# Simply remove the directory with
sudo rm -rf /usr/local/opt/php56
# and create the symlinks
brew link php56
# Now your php version should be up to date via the command line:
php -v
# Finish off the installation by configuring Apache to use the correct version
# Take note of the .so library for the new PHP version
brew info php56
# And copy the following
# To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so
# And replace the existing line in your Apache configuration file
sudo vi /etc/apache2/httpd.conf
# To finish up, you will need to transfer any configuration changes to your new ini file:
# To get the ini file, simply search for it:
php -i | grep php\.ini
# Which should echo:
# Configuration File (php.ini) Path => /usr/local/etc/php/5.6
# Loaded Configuration File => /usr/local/etc/php/5.6/php.ini
# So just edit that ini file
sudo vi /usr/local/etc/php/5.6/php.ini
# Make your changes to any settings (such as timezone and short_open_tags)
# Restart Apache
sudo apachectl restart
# And restart PHP
brew services start homebrew/php/php56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment