在Amazon Linux AMI上使用PHP5.4安装Gearman 1.1.12

时间:2015-10-22 01:18:38

标签: php amazon-ec2 gearman

我在Amazon Linux AMI上尝试了几个与Gearman安装相关的帖子。我按照以下步骤操作:

cd /var/tmp
wget https://launchpad.net/gearmand/1.2/1.1.12/+download/gearmand-1.1.12.tar.gz
tar xvzf gearmand-1.1.12.tar.gz
yum install libevent-devel gcc-c++ boost-devel libuuid-devel memcached-devel gperf
./configure
sudo make
sudo make install
sudo ldconfig

当我运行命令gearmand时,我可以看到它正在运行。

Gearman PHP库

sudo yum -y install php-pear
sudo pecl install gearman

我收到以下消息

Build process completed successfully
Installing '/usr/lib64/php/modules/gearman.so'
install ok: channel://pecl.php.net/gearman-1.1.2
Extension gearman enabled in php.ini

当我跑php --ini时,我得到了

Warning: PHP Startup: Unable to load dynamic library './gearman.so' - ./gearman.so: cannot open shared object file: No such file or directory in Unknown on line 0

所以,我编辑了php.ini文件并添加了

extension='/usr/lib64/php/modules/gearman.so'

现在,重新启动apache后,我得到了

Warning: PHP Startup: gearman: Unable to initialize module
Module compiled with module API=20090626
PHP    compiled with module API=20100525
These options need to match

这与PHP Gearman installation相同,但上述解决方案对我不起作用。

php -v给出

PHP 5.4.13 (cli) (built: Mar 29 2013 20:29:42) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

我正在使用Amazon Linux。

gearmand -V给出了

gearmand 1.1.12 - https://bugs.launchpad.net/gearmand

pear -V给出

PEAR Version: 1.9.5
PHP Version: 5.3.29
Zend Engine Version: 2.3.0
Running on: Linux ip-10-0-1-160 4.1.7-15.23.amzn1.x86_64 #1 SMP Mon Sep 14 23:20:33 UTC 2015 x86_64

pecl -V给出了

PEAR Version: 1.9.5
PHP Version: 5.3.29
Zend Engine Version: 2.3.0
Running on: Linux ip-10-0-1-160 4.1.7-15.23.amzn1.x86_64 #1 SMP Mon Sep 14 23:20:33 UTC 2015 x86_64

1 个答案:

答案 0 :(得分:0)

pear一样的问题。我用yum安装了它。所以,首先删除它。

sudo yum -y remove php-pear

然后我以这种方式安装了梨

wget http://pear.php.net/go-pear.phar
/usr/local/bin/php -q php-phar

现在pear -V显示

PEAR Version: 1.10.1
PHP Version: 5.4.13

然后,只是

pecl install gearman

然后复制php.ini中的gearman.so文件