Is it possible to install the pcntl module without recompiling php? I'm trying to set this up on CentOS.

5 Answers 5


try to find module with yum command yum search pcntl


I haven't been able to get it working purely through a package manager, and yum search pcntl finds no matches, even after setting up some additional repositories.

I ended up finding one way that worked without reinstalling PHP entirely, though it does end up requiring a tiny bit of recompilation. A post found here mentions a somewhat straightforward way of compiling and enabling just the pcntl extension ( with a little editing and reformatting of the post):

Get your current php version (check phpinfo())
Get the sources for that version here: http://www.php.net/releases/
Extract this file; you will got folder name like php5-x.x.x
Run following lines in terminal:

cd php5-x.x.x/ext/pcntl
cp modules/pcntl.so /usr/lib/php/modules/
echo "extension=pcntl.so" > /etc/php.d/pcntl.ini
restart apache

Note: if your /usr/lib/php/modules/ or /etc/php.d/ is not same
as this, you could try 'locate php/modules' or 'locate php.d'
  • 2
    This was extremely help to me and worked! Thank you very much.
    – A T
    Jan 21, 2015 at 22:05
  • When running configure configure: error: Cannot find php-config. Please use --with-php-config=PATH
    – Tofandel
    Mar 21 at 12:02
  • 1
    After adding the ondrej ppa and installing php8.0-dev error is gone
    – Tofandel
    Mar 21 at 12:34

The pcntl module is in the php-cli package and can be installed with yum by using the following command:

sudo yum install php php-cli

Check if this extension enabled.

php -m


php-fpm -m

If not exist, so you should it enable during build or build it as extension.


Download your existing PHP version repository from http://www.php.net/releases/ (This is no matter where you have to download & extract. You can either download to local machine. Just want to copy ext/pcntl to somewhere in the server)

Extract downloaded folder (Example: /home/downloads/PHP_5.x.x/)

cd /home/downloads/PHP_5.x.x/ext/pcntl
cp modules/pcntl.so /usr/local/lib/php/extensions/

[*This path is depend on your PHP installation/configurations. You can check the PHP extension path in php.ini or echo phpinfo(); ]

echo "extension=pcntl.so" > /usr/local/lib/php.ini 

or Add the line "extension=pcntl.so" to your php.ini

vim /usr/lib/php.ini

[*again depend on your PHP installation. You can find the php.ini path in locate php.ini or echo phpinfo(); ]


Not the answer you're looking for? Browse other questions tagged or ask your own question.