PHP安装gearman扩展编译报错:Makefile:194: recipe for target 'php_gearman.lo' failed

编译gearman-php报错:Makefile:194: recipe for target ‘php_gearman.lo’ failed

ubuntu下安装PHP7,编译安装gearman扩展时,make遇到这个报错。

按照网上的教程,从wget http://pecl.php.net/get/gearman-1.1.1.tgz下载下来的版本无法编译通过,查询之后这个链接显示:php7暂时还不支持gearman这个扩展

解决方案:

来自:https://techearl.com/php/installing-gearman-module-for-php7-on-ubuntu
直接从github上下载主分支最新的版本:sudo wget https://github.com/wcgallego/pecl-gearman/archive/master.zip,解压后按照之前的操作phpize,configure,make,makeinstall即可。

整体流程:

1.安装php、gearman:

sudo apt-get install php gearman libgearman-dev php7.0-dev php-mysql

2. 下载编译gearman pecl模块并添加到php.ini

cd /tmp/
sudo wget https://github.com/wcgallego/pecl-gearman/archive/master.zip
unzip master.zip
cd pecl-gearman-master
sudo phpize
./configure
sudo make
sudo make install
echo "extension=gearman.so" | sudo tee /etc/php/7.0/mods-available/gearman.ini
sudo phpenmod -v ALL -s ALL gearman

3. 重启PHP-FPM

sudo service php7.0-fpm restart

如果你用的是不同版本的php,确保你生效的改动在正确路径下的文件里。 比如/etc/php/7.0/ 改成 /etc/php/7.1/ 等等.

原创文章 39 获赞 33 访问量 2万+

猜你喜欢

转载自blog.csdn.net/Three_dog/article/details/103056171