How to install pcntl PHP extension in Mamp Pro on MacOS Catalina?

Ever wanted to install pnctl extension for Mamp PRO on Catalina in 16 easy steps? If yes, read below.

1. Make sure you have autoconfig installed:
brew install autoconf

2. Install XCode tools:
xcode-select --install

3. Check where you have SDKs installed by running:
xcrun --show-sdk-path
it should show
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk

4. Check where you have phpize installed by running:
which phpize
it should show:
/usr/bin/phpize

5. Make local copy of:
sudo cp /usr/bin/phpize /usr/local/phpize
sudo cp /usr/bin/php-config /usr/local/php-config

6. Run:
sudo nano /usr/local/phpize
and change includedir (line 8) to “/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/php”, so it will look like this (if you have different location in step 3 use it here instead of my):
includedir="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/php"

7. Run:
cd /Applications/MAMP/bin/php/php7.3.8/include/
in case you want to install pcntl for php 7.3.8, if you want different version change your dir to something else at /Applications/MAMP/bin/php/

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

8. Download php 7.3.8 sources (again, match your version) from https://php.net/releases/ :
wget https://www.php.net/distributions/php-7.1.31.tar.bz2

9. Unpack:
tar -xjvf php-7.3.8.tar.bz2

10. Change dir:
cd /Applications/MAMP/bin/php/php7.3.8/include/php-7.3.8/ext/pcntl

11. Run:
/usr/local/phpize
and it should show something like:
Configuring for:
PHP Api Version: 20180731
Zend Module Api No: 20180731
Zend Extension Api No: 320180731

without any error

12. Run:
./configure --with-php-config=/Applications/MAMP/bin/php/php7.3.8/bin/php-config
output should be like this:
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
(...)
creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h

13. Build out extension:
make && make install
output should end like this:
Build complete.
Don't forget to run 'make test'.
Installing shared extensions: /Applications/MAMP/bin/php/php7.3.8/lib/php/extensions/no-debug-non-zts-20180731/

14. Execute:
ls /Applications/MAMP/bin/php/php7.3.8/lib/php/extensions/no-debug-non-zts-20180731/
and you should see pcntl.so file among the others.

15. Edit your php.ini and add:
extension=pcntl.so

16. Check if you module is loaded by:
/Applications/MAMP/bin/php/php7.3.8/bin/php -m
and you should see pnctl in list

1 comment

Leave a Reply