How to install PHP extension 'pcntl' on my Mac OSX

Maker picture Maker · Dec 9, 2015 · Viewed 20.7k times · Source

My operating system is:Mac OSX 10.11

I'm trying to install Phabricator on my Mac, when I execute the command of

phabricator cpopt$ ./bin/phd start

I got an error:

"ERROR: The PHP extension 'pcntl' is not installed. You must install it to run daemons on this machine."

I've search this problem on google and I got lots of solutions,but they all don't work to me,I'm almost in despair.

How can I achieve that?

enter image description here

Answer

Clay picture Clay · Dec 9, 2015

Do you have brew installed (read here to install http://brew.sh/)?

Try:

brew install php

or if you need to install PHP 5.6 with brew you could do this:

brew install [email protected]

Then to include it in your PATH (if it is not automatically added), it may be necessary to run the commands in the CLI you may need to update your path, e.g. (this is the case if you were to brew install [email protected] but was not the case when I just tested with brew install php - if you are using bash instead of zsh, change .zshrc to .bashrc.

echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/usr/local/opt/[email protected]/sbin:$PATH"' >> ~/.zshrc

If that doesn't work, I wonder if phabricator is calling the right version of php.

Out of curiosity, what is the output you get from this? That is what phabricator is using to determine your php version.

/usr/bin/env php -v

Also... is your php.ini updated to have the pcntl extension? Run this to see your modules and look for pcntl:

php -i | grep pcntl

Double-check the php.ini that the php-cli is running:

php -i | grep php.ini