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,搞定!