Skip to content

Instantly share code, notes, and snippets.

@SObS
Forked from bipinu/install-ts-php.sh
Created February 14, 2017 12:09
Show Gist options
  • Save SObS/111b0aa3ae191361c09c5233ef24be40 to your computer and use it in GitHub Desktop.
Save SObS/111b0aa3ae191361c09c5233ef24be40 to your computer and use it in GitHub Desktop.
Install Thread Safe PHP, along with pthreads extension on OS X
# Note: Based on http://justinhileman.info/article/reinstalling-php-on-mac-os-x/
# Refer to the page in case of any issues
# Assumed that you have Brew install; else run the following commands
# xcode-select --install
# ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
brew update && brew upgrade
# Note: Following may be updated for appropriate PHP version
# Note: Breaks every once in a while, so --build-from-source
brew install php56 --build-from-source --with-thread-safety --with-httpd24 --without-snmp --with-pear --without-ldap
sudo mv /etc/php.ini /etc/php.ini.old
sudo ln -s /usr/local/etc/php/5.6/php.ini /etc/php.ini
# TODO: change upload_max_filesize and post_max_size to 1024M
echo "LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so" > $(brew --prefix homebrew/php/php56)/entropy-php.conf
sudo rm /etc/apache2/other/+php-osx.conf
sudo ln -s $(brew --prefix homebrew/php/php56)/entropy-php.conf /etc/apache2/other/+php-osx.conf
echo "AddType application/x-httpd-php .php" > /etc/apache2/other/+php-osx.conf
# Note: remove, or rename php, phpize, etc. binaries at /usr/bin/php*
# You might have to run brew link --overwrite
brew link php56
# PHP5.6 needs legacy driver mongo, instead of mongodb
sudo pecl install mongo
# brew install php56-mongo --build-from-source
brew install php56-mcrypt --build-from-source
brew install php56-opcache --build-from-source
brew install php56-xdebug --build-from-source
#sudo pecl install pthreads
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment