Now you need to find out what version of PHP is installed on OSX
and then get the source code for that version
When the download have finished, you should unpack, find the PCNTL extension, phpize, configure, make and then make install
$ php -v
PHP 5.3.10 with Suhosin-Patch (cli) (built: Feb 20 2012 22:55:53) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
and then get the source code for that version
$ curl -O http://us.php.net/distributions/php-5.3.10.tar.gz
When the download have finished, you should unpack, find the PCNTL extension, phpize, configure, make and then make install
$ tar -xzvf php-5.3.10.tar.gf
$ cd php-5.3.10/ext/pcntl
$ phpize
$ ./configure
$ make
$ sudo make install
sudo /Applications/XAMPP/xamppfiles/bin/phpize
sudo MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS="-arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch i386 -arch x86_64 -g -Os -pipe" CXXFLAGS="-arch i386 -arch x86_64 -g -Os -pipe" LDFLAGS="-arch i386 -arch x86_64 -bind_at_load" ./configure —enable-pcntl --with-php-config=/Applications/XAMPP/xamppfiles/bin/php-config
sudo make && sudo make install
我是真的不想重新編譯,安裝,因為我不知道會出現什么問題,而且麻煩,我就是不願意。
后來找了一哥們跟我碰到的情況一樣,http://ubuntuforums.org/showthread.php?t=549953,上面還是說,可以不重新編譯php5就可以增加pcntl這個模塊,用的還是phpize這個命令,而且他老大花了3個小時搞定……
那我就百度一下,phpize這個命令到底怎么搞,又有一哥們也碰到了我這樣的問題,http://www.linuxsir.org/bbs/showthread.php?p=1763019,直接apt-get install php5-dev就可以了,這哥們從發帖求助到自己解決用了9分鍾,還是07年的事情。
果然apt-get install php5-dev之后就有了phpize命令,然后按照第一個老外哥們的方法,解壓php源代碼之后,cd php/etc/pcntl,phpize,./configure,make,在module文件夾下就生成了pcntl.so文件,將其復制到php的extension_dir中,在php.ini文件中添加extension=pcntl.so,重啟apache,搞定!