Skip to content

Instantly share code, notes, and snippets.

@samyranavela
Forked from jbanety/build_pcntl.sh
Last active April 29, 2019 05:57
Show Gist options
  • Save samyranavela/b5b2a8a4839112b3997c44b4a7508c2c to your computer and use it in GitHub Desktop.
Save samyranavela/b5b2a8a4839112b3997c44b4a7508c2c to your computer and use it in GitHub Desktop.
Build PCNTL ext for MAMP PHP 7.1.8
#!/usr/bin/env bash
set -xo pipefail
# Command lines tools
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.8/include
cd /Applications/MAMP/bin/php/php7.1.8/include
# Download PHP 7.1.8 sources
if [ ! -f php-7.1.8.tar.bz2 ]; then
wget -q http://fr2.php.net/get/php-7.1.8.tar.bz2/from/this/mirror -O php-7.1.8.tar.bz2
fi
# Extract
if [ -f php-7.1.8.tar.bz2 ]; then
tar -xjvf php-7.1.8.tar.bz2
mv php-7.1.8 php
fi
# Configure PHP
cd /Applications/MAMP/bin/php/php7.1.8/include/php/php-7.1.8
./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.8 --exec-prefix=/Applications/MAMP/bin/php/php7.1.8 --sysconfdir=/Applications/MAMP/bin/php/php7.1.8/conf --with-config-file-path=/Applications/MAMP/bin/php/php7.1.8/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-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
# Phpize
cd /Applications/MAMP/bin/php/php7.1.8/include/php/php-7.1.8/ext/pcntl
phpize
# Build
./configure
make
# Install ext
if [ -f modules/pcntl.so ]; then
cp modules/pcntl.so /Applications/MAMP/bin/php/php7.1.8/lib/php/extensions/no-debug-non-zts-20160303/pcntl.so
cat << 'EOF' >> /Applications/MAMP/bin/php/php7.1.8/conf/php.ini
[pcntl]
extension=pcntl.so
EOF
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment