Are you having issues with compiling php extension for MAMP in OSX so here you can find some precompiled extensions so you do not have to compile and juggling with lots of compilation errors.
- php7.3.9 - pcntl.so
- php7.4.2 - pcntl.so
- php7.4.2 - mongodb.so
- Create
phpinfo.php
file and paste this code<?php phpinfo(); ?>
in your localhost and run http://localhost/phpinfo.php - Check your php.ini file path from the above url
- Open the php.in file and past this code
extension=pcntl.so
to the bottom of the file to enable the extension - Restart your server
- Refersh http://localhost/phpinfo.php and your extension should be visible now.
- download php from http://www.php.net/releases/
- tar -xzvf php-7.4.2.tar.gz
- cd php-7.4.2/ext/pcntl
- /Applications/MAMP/bin/php/php7.4.2/bin/phpize
- ./configure --prefix=/Applications/MAMP/bin/php/php7.4.2/bin/php
- make && make install
- Then the terminal will shows
Installing shared extensions: /Applications/MAMP/bin/php/php7.4.2/lib/php/extensions/no-debug-non-zts-20170718/
- Open MAMP PRO menu->File ->Edit Template->PHP->7.4.2 add below line at the end of the php.ini file
extension=pcntl.so
- Run the command
php --ri pcntl
and it will show messagepcntl support => enabled
Most of the times MAMP Pro set same php version in the command line does not work so you can set manually the php version
- Edit yoru ~/.bash_profile
- Paste this code
export PATH=/Applications/MAMP/bin/php/php7.4.2/bin:$PATH
- Save the file and Run this command
source ~/.bash_profile
- Check your php version now using command
php -v
Mamp uses different php config files for cli and mamp pro.
ln -s "/Library/Application Support/appsolute/MAMP PRO/conf/php7.4.2.ini" "/Applications/MAMP/bin/php/php7.4.2/conf/php.ini"
php --ini
- php command line was not showing the pcntl extenion because it was loading the different ini file so moved the loaded ini file to .bak and symlinked the MAMP PRO ini file to the loaded file path of php command line