如何在linux上安装memcached扩展(将memcached.so扩展添加到php.ini)

如何在linux上安装memcached扩展(将memcached.so扩展添加到php.ini),php,linux,amazon-ec2,memcached,Php,Linux,Amazon Ec2,Memcached,我已经将这一行添加到php.ini文件中 extension=memcached.so 当我运行php命令时,我得到了错误消息 [ec2-user@ip-172-31-1-237 ~]$ php -v PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/5.6/modules/memcached.so' - /usr/lib64/php/5.6/modules/memcached.so: canno

我已经将这一行添加到php.ini文件中

extension=memcached.so
当我运行php命令时,我得到了错误消息

[ec2-user@ip-172-31-1-237 ~]$ php -v
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/5.6/modules/memcached.so' - /usr/lib64/php/5.6/modules/memcached.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP 5.6.17 (cli) (built: Jan 16 2016 00:21:00)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
我正在AWSEC2(LinuxAMI)上部署php项目。 我已经在LinuxAMI上安装了memcached,并使用此命令成功运行memcached服务

sudo service memcached start 
我已经像这样检查了memcached服务状态

[ec2-user@ip-172-31-1-237 ~]$ echo stats | nc -4 localhost 11211
STAT pid 15597
STAT uptime 5807
...
END
wget http://pecl.php.net/get/memcached
tar -zxvf memcached
cd memcached-x.x.x
phpize
[ec2-user@ip-172-31-1-237 memcached-2.2.0]$ sudo yum install php-devel
Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main/latest                                                                         | 2.1 kB     00:00
amzn-updates/latest                                                                      | 2.3 kB     00:00
Resolving Dependencies
--> Running transaction check
---> Package php-devel.x86_64 0:5.3.29-1.8.amzn1 will be installed
--> Processing Dependency: php(x86-64) = 5.3.29-1.8.amzn1 for package: php-devel-5.3.29-1.8.amzn1.x86_64
--> Processing Dependency: libgmp.so.3()(64bit) for package: php-devel-5.3.29-1.8.amzn1.x86_64
--> Running transaction check
---> Package compat-gmp4.x86_64 0:4.3.2-1.14.amzn1 will be installed
---> Package php.x86_64 0:5.3.29-1.8.amzn1 will be installed
--> Processing Dependency: php-common(x86-64) = 5.3.29-1.8.amzn1 for package: php-5.3.29-1.8.amzn1.x86_64
--> Processing Dependency: httpd-mmn = 20051115 for package: php-5.3.29-1.8.amzn1.x86_64
--> Processing Dependency: php-cli(x86-64) = 5.3.29-1.8.amzn1 for package: php-5.3.29-1.8.amzn1.x86_64
--> Running transaction check
---> Package httpd.x86_64 0:2.2.31-1.6.amzn1 will be installed
--> Processing Dependency: httpd-tools = 2.2.31-1.6.amzn1 for package: httpd-2.2.31-1.6.amzn1.x86_64
--> Processing Dependency: apr-util-ldap for package: httpd-2.2.31-1.6.amzn1.x86_64
---> Package php-cli.x86_64 0:5.3.29-1.8.amzn1 will be installed
---> Package php-common.x86_64 0:5.3.29-1.8.amzn1 will be installed
--> Running transaction check
---> Package apr-util-ldap.x86_64 0:1.4.1-4.17.amzn1 will be installed
---> Package httpd-tools.x86_64 0:2.2.31-1.6.amzn1 will be installed
--> Processing Conflict: httpd24-2.4.16-1.63.amzn1.x86_64 conflicts httpd < 2.4.16
--> Processing Conflict: httpd24-tools-2.4.16-1.63.amzn1.x86_64 conflicts httpd-tools < 2.4.16
--> Processing Conflict: php55-5.5.31-1.111.amzn1.x86_64 conflicts php < 5.5.31-1.111.amzn1
--> Processing Conflict: php55-cli-5.5.31-1.111.amzn1.x86_64 conflicts php-cli < 5.5.31-1.111.amzn1
--> Processing Conflict: php55-common-5.5.31-1.111.amzn1.x86_64 conflicts php-common < 5.5.31-1.111.amzn1
--> Processing Conflict: php56-cli-5.6.17-1.120.amzn1.x86_64 conflicts php-cli < 5.5.22-1.98
--> Processing Conflict: php56-common-5.6.17-1.120.amzn1.x86_64 conflicts php-common < 5.5.22-1.98
--> Finished Dependency Resolution
Error: php55-cli conflicts with php-cli-5.3.29-1.8.amzn1.x86_64
Error: php56-common conflicts with php-common-5.3.29-1.8.amzn1.x86_64
Error: httpd24-tools conflicts with httpd-tools-2.2.31-1.6.amzn1.x86_64
Error: php55-common conflicts with php-common-5.3.29-1.8.amzn1.x86_64
Error: httpd24 conflicts with httpd-2.2.31-1.6.amzn1.x86_64
Error: php55 conflicts with php-5.3.29-1.8.amzn1.x86_64
Error: php56-cli conflicts with php-cli-5.3.29-1.8.amzn1.x86_64
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
然后我试着像这样安装memcached扩展

[ec2-user@ip-172-31-1-237 ~]$ echo stats | nc -4 localhost 11211
STAT pid 15597
STAT uptime 5807
...
END
wget http://pecl.php.net/get/memcached
tar -zxvf memcached
cd memcached-x.x.x
phpize
[ec2-user@ip-172-31-1-237 memcached-2.2.0]$ sudo yum install php-devel
Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main/latest                                                                         | 2.1 kB     00:00
amzn-updates/latest                                                                      | 2.3 kB     00:00
Resolving Dependencies
--> Running transaction check
---> Package php-devel.x86_64 0:5.3.29-1.8.amzn1 will be installed
--> Processing Dependency: php(x86-64) = 5.3.29-1.8.amzn1 for package: php-devel-5.3.29-1.8.amzn1.x86_64
--> Processing Dependency: libgmp.so.3()(64bit) for package: php-devel-5.3.29-1.8.amzn1.x86_64
--> Running transaction check
---> Package compat-gmp4.x86_64 0:4.3.2-1.14.amzn1 will be installed
---> Package php.x86_64 0:5.3.29-1.8.amzn1 will be installed
--> Processing Dependency: php-common(x86-64) = 5.3.29-1.8.amzn1 for package: php-5.3.29-1.8.amzn1.x86_64
--> Processing Dependency: httpd-mmn = 20051115 for package: php-5.3.29-1.8.amzn1.x86_64
--> Processing Dependency: php-cli(x86-64) = 5.3.29-1.8.amzn1 for package: php-5.3.29-1.8.amzn1.x86_64
--> Running transaction check
---> Package httpd.x86_64 0:2.2.31-1.6.amzn1 will be installed
--> Processing Dependency: httpd-tools = 2.2.31-1.6.amzn1 for package: httpd-2.2.31-1.6.amzn1.x86_64
--> Processing Dependency: apr-util-ldap for package: httpd-2.2.31-1.6.amzn1.x86_64
---> Package php-cli.x86_64 0:5.3.29-1.8.amzn1 will be installed
---> Package php-common.x86_64 0:5.3.29-1.8.amzn1 will be installed
--> Running transaction check
---> Package apr-util-ldap.x86_64 0:1.4.1-4.17.amzn1 will be installed
---> Package httpd-tools.x86_64 0:2.2.31-1.6.amzn1 will be installed
--> Processing Conflict: httpd24-2.4.16-1.63.amzn1.x86_64 conflicts httpd < 2.4.16
--> Processing Conflict: httpd24-tools-2.4.16-1.63.amzn1.x86_64 conflicts httpd-tools < 2.4.16
--> Processing Conflict: php55-5.5.31-1.111.amzn1.x86_64 conflicts php < 5.5.31-1.111.amzn1
--> Processing Conflict: php55-cli-5.5.31-1.111.amzn1.x86_64 conflicts php-cli < 5.5.31-1.111.amzn1
--> Processing Conflict: php55-common-5.5.31-1.111.amzn1.x86_64 conflicts php-common < 5.5.31-1.111.amzn1
--> Processing Conflict: php56-cli-5.6.17-1.120.amzn1.x86_64 conflicts php-cli < 5.5.22-1.98
--> Processing Conflict: php56-common-5.6.17-1.120.amzn1.x86_64 conflicts php-common < 5.5.22-1.98
--> Finished Dependency Resolution
Error: php55-cli conflicts with php-cli-5.3.29-1.8.amzn1.x86_64
Error: php56-common conflicts with php-common-5.3.29-1.8.amzn1.x86_64
Error: httpd24-tools conflicts with httpd-tools-2.2.31-1.6.amzn1.x86_64
Error: php55-common conflicts with php-common-5.3.29-1.8.amzn1.x86_64
Error: httpd24 conflicts with httpd-2.2.31-1.6.amzn1.x86_64
Error: php55 conflicts with php-5.3.29-1.8.amzn1.x86_64
Error: php56-cli conflicts with php-cli-5.3.29-1.8.amzn1.x86_64
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
但我得到如下错误消息:

[ec2-user@ip-172-31-1-237 memcached-2.2.0]$ phpize
Can't find PHP headers in /usr/include/php/5.6/php
The php-devel package is required for use of this command.
所以我试着像这样安装php-devel

[ec2-user@ip-172-31-1-237 ~]$ echo stats | nc -4 localhost 11211
STAT pid 15597
STAT uptime 5807
...
END
wget http://pecl.php.net/get/memcached
tar -zxvf memcached
cd memcached-x.x.x
phpize
[ec2-user@ip-172-31-1-237 memcached-2.2.0]$ sudo yum install php-devel
Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main/latest                                                                         | 2.1 kB     00:00
amzn-updates/latest                                                                      | 2.3 kB     00:00
Resolving Dependencies
--> Running transaction check
---> Package php-devel.x86_64 0:5.3.29-1.8.amzn1 will be installed
--> Processing Dependency: php(x86-64) = 5.3.29-1.8.amzn1 for package: php-devel-5.3.29-1.8.amzn1.x86_64
--> Processing Dependency: libgmp.so.3()(64bit) for package: php-devel-5.3.29-1.8.amzn1.x86_64
--> Running transaction check
---> Package compat-gmp4.x86_64 0:4.3.2-1.14.amzn1 will be installed
---> Package php.x86_64 0:5.3.29-1.8.amzn1 will be installed
--> Processing Dependency: php-common(x86-64) = 5.3.29-1.8.amzn1 for package: php-5.3.29-1.8.amzn1.x86_64
--> Processing Dependency: httpd-mmn = 20051115 for package: php-5.3.29-1.8.amzn1.x86_64
--> Processing Dependency: php-cli(x86-64) = 5.3.29-1.8.amzn1 for package: php-5.3.29-1.8.amzn1.x86_64
--> Running transaction check
---> Package httpd.x86_64 0:2.2.31-1.6.amzn1 will be installed
--> Processing Dependency: httpd-tools = 2.2.31-1.6.amzn1 for package: httpd-2.2.31-1.6.amzn1.x86_64
--> Processing Dependency: apr-util-ldap for package: httpd-2.2.31-1.6.amzn1.x86_64
---> Package php-cli.x86_64 0:5.3.29-1.8.amzn1 will be installed
---> Package php-common.x86_64 0:5.3.29-1.8.amzn1 will be installed
--> Running transaction check
---> Package apr-util-ldap.x86_64 0:1.4.1-4.17.amzn1 will be installed
---> Package httpd-tools.x86_64 0:2.2.31-1.6.amzn1 will be installed
--> Processing Conflict: httpd24-2.4.16-1.63.amzn1.x86_64 conflicts httpd < 2.4.16
--> Processing Conflict: httpd24-tools-2.4.16-1.63.amzn1.x86_64 conflicts httpd-tools < 2.4.16
--> Processing Conflict: php55-5.5.31-1.111.amzn1.x86_64 conflicts php < 5.5.31-1.111.amzn1
--> Processing Conflict: php55-cli-5.5.31-1.111.amzn1.x86_64 conflicts php-cli < 5.5.31-1.111.amzn1
--> Processing Conflict: php55-common-5.5.31-1.111.amzn1.x86_64 conflicts php-common < 5.5.31-1.111.amzn1
--> Processing Conflict: php56-cli-5.6.17-1.120.amzn1.x86_64 conflicts php-cli < 5.5.22-1.98
--> Processing Conflict: php56-common-5.6.17-1.120.amzn1.x86_64 conflicts php-common < 5.5.22-1.98
--> Finished Dependency Resolution
Error: php55-cli conflicts with php-cli-5.3.29-1.8.amzn1.x86_64
Error: php56-common conflicts with php-common-5.3.29-1.8.amzn1.x86_64
Error: httpd24-tools conflicts with httpd-tools-2.2.31-1.6.amzn1.x86_64
Error: php55-common conflicts with php-common-5.3.29-1.8.amzn1.x86_64
Error: httpd24 conflicts with httpd-2.2.31-1.6.amzn1.x86_64
Error: php55 conflicts with php-5.3.29-1.8.amzn1.x86_64
Error: php56-cli conflicts with php-cli-5.3.29-1.8.amzn1.x86_64
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
[ec2-user@ip-172-31-1-237 memcached-2.2.0]$sudo yum安装php-devel
加载的插件:优先级、更新motd、升级助手
amzn主/最新版本| 2.1KB 00:00
amzn更新/最新版本| 2.3KB 00:00
解决依赖关系
-->运行事务检查
--->将安装程序包php-devel.x86_64 0:5.3.29-1.8.amzn1
-->处理依赖项:php(x86-64)=5.3.29-1.8.amzn1,对于包:php-devel-5.3.29-1.8.amzn1.x8664
-->程序包的处理依赖项:libgmp.so.3()(64位):php-devel-5.3.29-1.8.amzn1.x86_64
-->运行事务检查
--->将安装软件包compat-gmp4.x86_64 0:4.3.2-1.14.amzn1
--->将安装软件包php.x86_64 0:5.3.29-1.8.amzn1
-->处理依赖项:php-common(x86-64)=5.3.29-1.8.amzn1对于包:php-5.3.29-1.8.amzn1.x8664
-->程序包:php-5.3.29-1.8.amzn1.x8664的处理依赖项:httpd mmn=20051115
-->处理依赖项:php-cli(x86-64)=5.3.29-1.8.amzn1对于包:php-5.3.29-1.8.amzn1.x8664
-->运行事务检查
--->将安装程序包httpd.x86_64 0:2.2.31-1.6.amzn1
-->处理依赖项:httpd tools=2.2.31-1.6.amzn1对于包:httpd-2.2.31-1.6.amzn1.x8664
-->处理依赖项:apr util ldap for package:httpd-2.2.31-1.6.amzn1.x86_64
--->将安装程序包php-cli.x86_64 0:5.3.29-1.8.amzn1
--->将安装程序包php-common.x86_64 0:5.3.29-1.8.amzn1
-->运行事务检查
--->将安装程序包apr-util-ldap.x86_64 0:1.4.1-4.17.amzn1
--->将安装程序包httpd-tools.x86_64 0:2.2.31-1.6.amzn1
-->处理冲突:httpd24-2.4.16-1.63.amzn1.x86_64冲突httpd<2.4.16
-->处理冲突:httpd24-tools-2.4.16-1.63.amzn1.x86_64冲突httpd-tools<2.4.16
-->处理冲突:php55-5.5.31-1.111.amzn1.x86_64冲突php<5.5.31-1.111.amzn1
-->处理冲突:php55-cli-5.5.31-1.111.amzn1.x86_64冲突php cli<5.5.31-1.111.amzn1
-->处理冲突:php55-common-5.5.31-1.111.amzn1.x86_64冲突php-common<5.5.31-1.111.amzn1
-->处理冲突:php56-cli-5.6.17-1.120.amzn1.x86_64冲突php cli<5.5.22-1.98
-->处理冲突:php56-common-5.6.17-1.120.amzn1.x86_64冲突php-common<5.5.22-1.98
-->已完成依赖项解析
错误:php55 cli与php-cli-5.3.29-1.8.amzn1.x86_64冲突
错误:php56通用与php-common-5.3.29-1.8.amzn1.x86_64冲突
错误:httpd24工具与httpd-tools-2.2.31-1.6.amzn1.x86_64冲突
错误:php55与php-common-5.3.29-1.8.amzn1.x86_64冲突
错误:httpd24与httpd-2.2.31-1.6.amzn1.x86_64冲突
错误:php55与php-5.3.29-1.8.amzn1.x86_64冲突
错误:php56 cli与php-cli-5.3.29-1.8.amzn1.x86_64冲突
您可以尝试使用--skip break来解决这个问题
您可以尝试运行:rpm-Va--nofiles--nodigest
谁能帮我?
关于。

没有使用apt get安装的选项?@Filp为什么要安装两个不同版本的Memcached软件包?