---
title: "【 转】pcntl.so install for system’s PHP install"
author: "shake863"
date: "2012-05-05T20:24:09Z"
tags: []
categories: ["互联网"]
slug: "pcntl-so-install-for-system-s-php-install"
draft: false
lastmod: "2012-05-05T20:24:09Z"
id: 1512977
url: "https://shake863.iteye.com/blog/1512977"
---

## 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](http://php.net/downloads.php#v5). Since I’m using [MAMP](http://www.mamp.info/) 2.0.5 and it comes with PHP 5.3.6, I had to go to the old releases page [here](http://www.php.net/releases/).

```
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:

```
extension=pcntl.so
```

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:

```
extension=pcntl.so
```

![MAMP PHP Template ](http://bit.ly/vmChQz)

Restart MAMP… **pcntl extension should now be installed for the system’s PHP and MAMP’s PHP.**

Output of phpinfo(); will show this:

**![](http://bit.ly/tnIliZ "PCNTL Installed")**

 

 

http://cyberpunx.com/2011/11/pcntl-so-on-osx-lion-and-mamp/