我正试图在Ubuntu上安装gearman,安装失败并显示以下错误。
PHP Warning: PHP Startup: Unable to load dynamic library 'gearman.so' (tried: /usr/lib/php/20170718/gearman.so (/usr/lib/php/20170718/gearman.so: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/gearman.so.so (/usr/lib/php/20170718/gearman.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
pecl/gearman requires PHP (version >= 5.1.0, version <= 6.0.0, excluded versions: 6.0.0), installed version is 7.2.24-0ubuntu0.18.04.6
No valid packages found
install failed
该消息详细说明了它正在查找gearman.so文件的位置-将其放在其中一个位置,它应该可以工作。
然而,来自的最新版本http://pecl.php.net/package/gearman已经为Ubuntu打包了,所以我更喜欢用apt安装它。这是我在Ubuntu 20.04:上得到的
$ sudo apt install php-gearman
$ echo '<?php print gearman_version() . "n"; ?>' > gearman_test.php
$ php gearman_test.php
1.1.18+ds