主要参考官网安装文档:https://github.com/kakserpom/phpdaemon/wiki/Installation-%28common%29点击打开链接
1.下载源码:https://github.com/kakserpom/phpdaemon/archives/master点击打开链接
文件放到预安装目录,然后解压:tar xzf phpdaemon*.tar.gz
2.配置安装前的环境
2.1:确认php5安装时 compiled with ‘—enable-pcntl’ ‘—enable-shmop’ ‘—enable-sockets’。我用apt-get安装的php,已经启用了“shmop”与“sockets”,然后根据一篇博客启用"pcntl".
2.1.1启用“pcntl”(参考:http://www.crimulus.com/2010/07/30/howto-enable-pcntl-in-ubuntu-php-installations/点击打开链接)
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/
echo "extension=pcntl.so" > /etc/php5/conf.d/pcntl.ini
2.2:
安装libevent(参考:http://serverfault.com/questions/271554/problems-installing-php-libevent-pecl-package
点击打开链接)
sudo apt-get install libevent-dev
pecl install libevent
然后到php.ini中添加一行:“extension=libevent.so”
注意:此处修改的php.ini是在cli目录下的,因为是命令行运行。(可以用“php --ini”命令查看其路径)。web 服务器运行php的配置文件可以用“phpinfo()”函数查看调用的php.ini的位置。
3.运行
$path/bin/phpd start