Ubuntu下面安装gearman以及php的gearman扩展是需要注意一下的。
不是默认的安装就直接OK
apt-get install gearman
安装完gearman后。使用pecl install gearman安装。这时候会提示你安装新版 的libgearman
如果你直接搜索apt-cache search libgearman,会发现有很多,但其实一个都不是。。不用上当了
OK,怎么办?有人也问过这个问题:http://stackoverflow.com/questions/13312207/installing-gearman-php-extension-on-debian-6
有人这么回复 :
The reason that this doesn't work is that as the error message says, the most recent version of the PHP extension requires libgearman-1.0 (which is why the directory is named 1.0). You'll need to be at least on wheezy (which is the version after debian 6 / squeeze) to get libgearman-1.0.
It might also be a solution to compile libgearman from source, and then use checkinstall
to create a debian package that you install afterwards, or use the gearman developer ppa available at https://launchpad.net/~gearman-developers/+archive/ppa
. We've built libgearman, gearmand and the PHP extension on a wide variety of distributions (including Debian, Ubuntu, RHEL4 and SL6) and used checkinstall to get a proper package available.
嗯,打开这个网址。
在最上面有提醒你怎么将PPA将入源里:
Adding this PPA to your system
You can update your system with unsupported packages from this untrusted PPA by adding ppa:gearman-developers/ppa to your system's Software Sources. (Read about installing)
OK,那我们开始吧:
apt-add-repository ppa:gearman-developers/ppa
然后,你根据你的版本,将源加到你的source.list文件里:
vim /etc/apt/source.list
加入:
deb http://ppa.launchpad.net/gearman-developers/ppa/ubuntu precise main deb-src http://ppa.launchpad.net/gearman-developers/ppa/ubuntu precise main
然后:apt-get update
apt-get upgrade
会提醒你需要升级gearman到最新版 本
这时候再:
pecl install gearman
然后就直接安装成功,会提示你怎么操作:XML/HTML代码
- Build process completed successfully
- Installing '/usr/lib/php5/20090626+lfs/gearman.so'
- install ok: channel://pecl.php.net/gearman-1.1.1
- configuration option "php_ini" is not set to php.ini location
- You should add "extension=gearman.so" to php.ini
按照提示操作完后,重启apache。
在命令行下执行:XML/HTML代码
- # php -i |grep gearman
- gearman
- gearman support => enabled
- libgearman version => 0.40
wow...安装成功。
就是这么简单
版权协议, 要求署名、非商业和保持一致. 本站欢迎任何非商业应用的转载, 但须注明出自"