Skip to content

Instantly share code, notes, and snippets.

@jbanety
Last active February 6, 2024 02:50
Show Gist options
  • Star 39 You must be signed in to star a gist
  • Fork 19 You must be signed in to fork a gist
  • Save jbanety/35d01689608ad89777d349f65c7b39c9 to your computer and use it in GitHub Desktop.
Save jbanety/35d01689608ad89777d349f65c7b39c9 to your computer and use it in GitHub Desktop.
(Updated) Build PCNTL ext for MAMP PHP 7.4.2
#!/bin/bash
PHP_VERSION=7.4.2
# Command lines tools
xcode-select --install
# Install dependencies
brew install wget autoconf openssl lzlib curl imap-uw readline postgresql gettext libxslt libiconv bison pkg-config krb5 bzip2 openldap tidy-html5
# Dirs
mkdir -p /Applications/MAMP/bin/php/php$PHP_VERSION/include
cd /Applications/MAMP/bin/php/php$PHP_VERSION/include
# Download PHP 7 sources
wget http://fr2.php.net/get/php-$PHP_VERSION.tar.bz2/from/this/mirror -O php-$PHP_VERSION.tar.bz2
# Extract
tar -xjvf php-$PHP_VERSION.tar.bz2
mv php-$PHP_VERSION php
# Configure PHP
cd /Applications/MAMP/bin/php/php$PHP_VERSION/include/php/php-$PHP_VERSION
PKG_CONFIG=/usr/local/opt/pkg-config/bin/pkg-config PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/opt/krb5/lib/pkgconfig:/usr/local/opt/openssl/lib/pkgconfig:/usr/local/opt/icu4c/lib/pkgconfig YACC=/usr/local/opt/bison/bin/bison ./configure --prefix=/Applications/MAMP/bin/php/php$PHP_VERSION --exec-prefix=/Applications/MAMP/bin/php/php$PHP_VERSION --sysconfdir=/Applications/MAMP/bin/php/php$PHP_VERSION/conf --with-config-file-path=/Applications/MAMP/bin/php/php$PHP_VERSION/conf --enable-gd --with-jpeg --with-zlib --with-zlib-dir=/usr/local/opt/lzlib --enable-ftp --with-bz2=/usr/local/opt/bzip2 --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-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-openssl=/usr/local/opt/openssl --with-iconv=/usr/local/opt/libiconv --enable-opcache --enable-intl --with-tidy=/usr/local/opt/tidy-html5 --with-readline=/usr/local/opt/readline --with-mhash --with-ldap=/usr/local/opt/openldap
# Add MAMP's PHP binaries to PATH
export PATH=/Applications/MAMP/bin/php/php$PHP_VERSION/bin/:$PATH
# Phpize
cd /Applications/MAMP/bin/php/php$PHP_VERSION/include/php/php-$PHP_VERSION/ext/pcntl
phpize
# Build
./configure
make
# Install ext
cp modules/pcntl.so /Applications/MAMP/bin/php/php$PHP_VERSION/lib/php/extensions/$(ls /Applications/MAMP/bin/php/php$PHP_VERSION/lib/php/extensions)
echo "extension=pcntl.so" >> /Applications/MAMP/bin/php/php$PHP_VERSION/conf/php.ini
@MMTE
Copy link

MMTE commented Jun 23, 2020

thanks worked on php 7.4.1 !

@jEstevezRod
Copy link

worked like a charm for php 7.4.2!

@kryzhnii
Copy link

Amazing!

@khanakia
Copy link

khanakia commented Feb 5, 2021

You can download the precompiled extensions from here https://github.com/khanakiaphp/mamp_extensions

@heitorglockner1
Copy link

Beatiful. Thanks

@xwiz
Copy link

xwiz commented Aug 14, 2022

Has anyone done this for PHP8?

@smobiler
Copy link

smobiler commented Feb 6, 2024

Worked with php 7.3.33. Thanks a lot! 👍👍👍

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