Enable PNCTL Extension to PHP (Ubuntu 14.04)

Process Control support in PHP implements the Unix style of process creation, program execution, signal handling and process termination. Process Control should not be enabled within a web server environment and unexpected results may happen if any Process Control functions are used within a web server environment.

I have spend a day enabling this extension. I have searched a lot, but failed every single time because, I have missed a single line of command. So, here are the steps I followed and get it done.


Create a directory
mkdir /tmp/phppnctl

Navigate
cd /tmp/phppnctl

Fetch the PHP source
apt-get source php5

Navigate
cd /tmp/phppnctl/php5-*/ext/pcntl

Run this command
phpize

Run this command
./configure

Make the object
make

Navigate
cd modules

Copy the file
cp pcntl.so /usr/lib/php5/<long number like 201090621>/

Enable extension to ini file
echo "extension=pcntl.so" > /etc/php5/mods-available/pcntl.ini

Execute this command
php5enmod pcntl

Restart Apache
service apache2 restart

Verify
$ php -m | grep pcntl
$ pcntl

Reference:
http://stackoverflow.com/questions/14096130/enable-pcntl-in-ubuntu-php-test-fails
http://www.lornajane.net/posts/2012/managing-php-5-4-extensions-on-ubuntu

Leave a comment