0

I am using MAMP Pro to manage my development environments, the PHP is version 7.0.12 and is running in module mode.

I have added the pcntl module for PHP and have compiled it following the directions from this answer.

The pcntl.so file is in my /Applications/MAMP/bin/php/php7.0.12/lib/php/extensions/no-debug-non-zts-20151012 folder. Also, on my vhost I can output phpinfo() and verify that the extension is installed and additionally checked it by function_exists('pcntl_signal') which returns true.

However, I can't get it to work when running PHP from the terminal. I am using the one that MAMP installs and am invoking it through /Applications/MAMP/bin/php/php7.0.12/bin/php. However, I get the error that the function pcntl_signal does not exist.

Also running /Applications/MAMP/bin/php/php7.0.12/bin/php -i | grep pcntl doesn't output anything.

Is there a way to make the pcntl module available to PHP through the command line in addition to the one apache is using?

Community
  • 1
  • 1
kyle
  • 2,563
  • 6
  • 22
  • 37
  • 2
    Typically the module and the CLI version of php use separate `php.ini` files. Maybe you mention the new module only in one of them? – arkascha Oct 31 '16 at 14:19

1 Answers1

0

There are two separate ini files that MAMP uses for PHP.

One is editable through the GUI, the other needs to be manually edited. For this PHP version the extension must be added in /Applications/MAMP/bin/php/php7.0.12/conf/php.ini

After adding extension=pcntl.so into the above ini file, running php -i | grep pcntl will output

pcntl

pcntl support => enabled

kyle
  • 2,563
  • 6
  • 22
  • 37