怎样在Ubuntu下开启PHP的pnctl进程管理扩展

Howto: Enable PCNTL in Ubuntu PHP installations

怎样启用Ubuntu(deb包)安装PHP的PCNTL


PCNTL in PHP allows for some handy advanced “trickery” using the OS process functions inherent in Linux (*nix?).  I believe some features are available in Windows, but I know for certain that pcntl_fork() is not.



Anyway, it is not enabled by default, so if you want to take advantage of the functions on your Ubuntu LAMP server, you might spend hours searching the web for that magic aptitude command.  But, as far as I can tell, it doesn’t exist.


Luckily, I stumbled across this article on the Ubuntu forums, so I’m dedicating a post here with the hopes that other will find it more easily.


Please note that you’ll probably need build-essentials and a few other source compilation basics, but as long as you have that, the following code will get you what you want.


First, in your home directory:
上面大致介绍了PNCTL的好处,但是默认在linux下是没有启用这个功能的,在这里作者使用的是Ubuntu下的LAMP安装,通过一下过程就可以开启需要的功能

mkdir php
cd php
apt-get source php5
cd php5-(WHATEVER_RELEASE)/ext/pcntl
phpize
./configure
make
Then:

cp modules/pcntl.so /usr/lib/php5/WHEVER_YOUR_SO_FILES_ARE/

拷贝so文件到php5的扩展目录

echo "extension=pcntl.so" > /etc/php5/conf.d/pcntl.ini

修改配置文件,在deb安装的环境下扩展配置是都是独立的文件

FYI: “make install” does not appear to put the files in the correct place.
可能使用make install并不能拷贝文件到php扩展目录,经过测试是可以的,如果是普通用户,需要使用sudo来执行。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值