Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable pcntl extensions in MAMP pro?

I am using laravel/horizon with Osx MAMP pro

when I run the composer it requires laravel/horizon:~1.0

it shows a message -

laravel/horizon v1.0.8 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system.

I checked the folder /Applications/MAMP/bin/php7.1.1/php/ext,it doesn't contain pcntl extension.

How can I install that?

like image 785
Evol Rof Avatar asked Nov 28 '22 20:11

Evol Rof


2 Answers

  1. download php from http://www.php.net/releases/
  2. tar -xzvf php-7.2.1.tar.gz
  3. cd php-7.2.1/ext/pcntl
  4. /Applications/MAMP/bin/php/php7.2.1/bin/phpize
  5. as @ drewjoh metioned ./configure --with-php-config=/Applications/MAMP/bin/php/php7.2.1/bin/php-config --prefix=/Applications/MAMP/bin/php/php7.2.1/bin/php
  6. make && make install
  7. the terminal shows

Installing shared extensions: /Applications/MAMP/bin/php/php7.2.1/lib/php/extensions/no-debug-non-zts-20170718/

  1. open MAMP PRO menu->File ->Edit Template->PHP->7.2.1 add extension=pcntl.so at the end of the php.ini file .

  2. run the command php --ri pcntl and shows pcntl pcntl support => enabled

like image 51
Evol Rof Avatar answered Dec 06 '22 04:12

Evol Rof


Just an addition. Perhaps you followed the above step and still can't get it installed to /Applications/MAMP/bin/php/php7.2.1/lib/php/extensions/no-debug-non-zts-20170718/. Here is something I did that worked for me.

I added the --with-php-config before the --prefix flag and it worked. See step below.

  1. download your MAMP php version from http://www.php.net/releases/ Mine is php7.2.22

Open your terminal and cd into your download folder. Then run this command to decompress the tar.gz file

tar -xzvf php-7.2.22.tar.gz

Cd into the pcntl directory after decompressing.

cd php-7.2.22/ext/pcntl

Run the next line from your terminal to Configure for PHP Api, Zend Module Api, and Zend Extension Api.

/Applications/MAMP/bin/php/php7.2.22/bin/phpize

Then run

./configure --with-php-config=/Applications/MAMP/bin/php/php7.2.22/bin/php-config --prefix=/Applications/MAMP/bin/php/php7.2.22/bin/php; make && make install;

You should see

Installing shared extensions:     /Applications/MAMP/bin/php/php7.2.22/lib/php/extensions/no-debug-non-zts-20170718/

Then you can repeat the last two steps above.

like image 30
Ifeanyi Amadi Avatar answered Dec 06 '22 05:12

Ifeanyi Amadi