phpphabricatorpcntl

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


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


Solution

  • 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 php@5.6
    

    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 php@7.1 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/php@7.1/bin:$PATH"' >> ~/.zshrc
    echo 'export PATH="/usr/local/opt/php@7.1/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