Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ngocongcan/1642dd24ebf4f0b8c3a6a7044e6af25c to your computer and use it in GitHub Desktop.
Save ngocongcan/1642dd24ebf4f0b8c3a6a7044e6af25c to your computer and use it in GitHub Desktop.
xcode-select --install
# Install dependencies
brew install wget autoconf openssl libjpeg libpng lzlib curl imap-uw readline postgresql libxml2 mcrypt gettext libxslt homebrew/dupes/libiconv icu4c expat bison webp freetype
# Dirs
mkdir -p /Applications/MAMP/bin/php/php7.1.12/include
cd /Applications/MAMP/bin/php/php7.1.12/include
# Download PHP 7.1.12 sources
wget http://fr2.php.net/get/php-7.1.12.tar.bz2/from/this/mirror -O php-7.1.12.tar.bz2
# Extract
tar -xjvf php-7.1.12.tar.bz2
mv php-7.1.12 php
# Configure PHP
cd /Applications/MAMP/bin/php/php7.1.12/include/php/php-7.1.12
./configure --with-gd=shared --with-jpeg-dir=/usr/local/opt/jpeg --with-png-dir=/usr/local/opt/libpng --with-zlib --with-zlib-dir=/usr/local/opt/lzlib --with-freetype-dir=/usr/local/opt/freetype --prefix=/Applications/MAMP/bin/php/php7.1.12 --exec-prefix=/Applications/MAMP/bin/php/php7.1.12 --sysconfdir=/Applications/MAMP/bin/php/php7.1.12/conf --with-config-file-path=/Applications/MAMP/bin/php/php7.1.12/conf --enable-ftp --enable-gd-native-ttf --with-bz2=/usr --with-ldap --with-mysqli=mysqlnd --enable-mbstring=all --with-curl=/usr/local/opt/curl --enable-sockets --enable-bcmath --with-imap=shared,/usr/local/opt/imap-uw --enable-soap --with-kerberos --enable-calendar --with-pgsql=shared,/usr/local/opt/postgresql --enable-exif --with-libxml-dir=/usr/local/opt/libxml2 --with-gettext=shared,/usr/local/opt/gettext --with-xsl=/usr/local/opt/libxslt --with-pdo-mysql=mysqlnd --with-pdo-pgsql=shared,/usr/local/opt/postgresql --with-mcrypt=shared,/usr/local/opt/mcrypt --with-openssl=/usr/local/opt/openssl --enable-sysvsem --enable-zip --with-iconv=/usr/local/opt/libiconv --enable-opcache --enable-intl --with-tidy=shared --with-icu-dir=/usr/local/opt/icu4c --enable-wddx --with-libexpat-dir=/usr/local/opt/expat --with-readline=/usr/local/opt/readline --with-mhash YACC=/usr/local/opt/bison/bin/bison --with-webp-dir=/usr/local/opt/webp
# Add MAMP's PHP binaries to PATH
export PATH=/Applications/MAMP/bin/php/php7.1.12/bin/:$PATH
# Phpize
cd /Applications/MAMP/bin/php/php7.1.12/include/php/php-7.1.12/ext/pcntl
phpize
# Build
./configure
make
# Install ext
cp modules/pcntl.so /Applications/MAMP/bin/php/php7.1.12/lib/php/extensions/no-debug-non-zts-20160303/
echo "extension=pcntl.so" >> /Applications/MAMP/bin/php/php7.1.12/conf/php.ini
cd /Applications/MAMP/bin/php/php7.1.12/include/php/php-7.1.12/ext/sysvsem
phpize
# Build
./configure
make
cp modules/sysvsem.so /Applications/MAMP/bin/php/php7.1.12/lib/php/extensions/no-debug-non-zts-20160303/
echo "extension=sysvsem.so" >> /Applications/MAMP/bin/php/php7.1.12/conf/php.ini
@Potato-007
Copy link

thank you, it helped me a lot!

in 4th line > 'homebrew/dupes/libiconv' gives an error, changing it to 'libiconv' works

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