How to install PHP extension 'pcntl' on my Mac OSX
Asked Answered
L

3

7

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

Lockjaw answered 9/12, 2015 at 8:58 Comment(0)
S
12

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
Sparke answered 9/12, 2015 at 10:39 Comment(6)
According to your method, I install the homebrew and execute the command 'brew install homebrew/php/php55-pcntl ', It's works to me.Thank you very much,you save my time.Your help is greatly appreciated.Lockjaw
also, brew is a package management tool so you'll likely use it to install many things on the future on OSX too!Sparke
OK,I got it, Thank youLockjaw
@ClaytonSmith please if you could help me to install these php extensions...i have brew and php7 on MAC but i can't install these: OpenSSL PHP Extension PDO PHP Extension Mbstring PHP Extension Tokenizer PHP Extension XML PHP Extension i can't find the commandJudon
I am getting this error Error: No available formula with the name "homebrew/php/php55-pcntl" on allMonkshood
@MuhammadUmar I've updated the answer, feel to upvote if it helps you.Sparke
K
1

I had to do this to install the platform.sh command line tool. This was the top hit in Google so I'm adding this information. The process I followed was as below.

In Terminal:

Add yourself to the 'wheel' user group.

sudo dscl . append /Groups/wheel GroupMembership <username>

Grant group write access to /usr/local/bin

sudo chmod -R g+w /usr/local/bin

Link libpng for brew

brew link libpng

Install pcntl for php (5.6 in my case)

brew install homebrew/php/php56-pcntl
Koski answered 24/3, 2017 at 12:49 Comment(1)
Error: homebrew/php was deprecated.Decoct
T
0

Just in case anyone else uses MAMP, I recently updated it to the latest version. Then I was getting the error

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

I had not restarted my terminal since I updated it. After reloading the session everything worked fine.

Tenebrae answered 23/9, 2021 at 3:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.