pcntl.so install for system’s PHP install
Recently I needed to use pcntl_fork with a project and found that the stack I was using (MAMP) didn’t include support for pcntl.so by default. Fortunately it’s pretty easy to install on Lion.
Download the appropriate PHP source code from here. Since I’m using MAMP 2.0.5 and it comes with PHP 5.3.6, I had to go to the old releases page here.
curl http://museum.php.net/php5/php-5.3.6.tar.gz > php-5.3.6.tar.gz tar xvfz php-5.3.6.tar.gz cd php-5.3.6/ext/pcntl
Now for the build:
phpize ./configure make sudo make install
Now we need to add the pcntl.so to the php.ini …so open /private/etc/php.ini with your favorite editor and add the following line:
After saving, run the following command and it should output ‘pcntl’:
php -m | grep pcntl
Optional MAMP install:
Now lets copy pcntl.so to the MAMP extension folder:
cp /usr/lib/php/extensions/no-debug-non-zts-20090626/pcntl.so /Applications/MAMP//bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/
Edit the php.ini template for MAMP’s PHP install and add:
Restart MAMP… pcntl extension should now be installed for the system’s PHP and MAMP’s PHP.
Output of phpinfo(); will show this: