【PHP】在PHP7中运行memcached
首先
如何安装PHP7?
作为前提条件,已经按照以下方法安装了PHP7。
http://qiita.com/qiita-kurara/items/7f4619c04e5fee212147
参考了的页面
当使用“php7 memcached”进行谷歌搜索时,前辈们已经总结了在PHP7中运行memcached的方法。可以在以下链接中找到相关信息:
http://blog.webmemo.red/linux/php7-memcached-extension-install/
http://dqn.sakusakutto.jp/2015/07/php7_trap.html
只要您能够顺利地浏览以上页面并且没有出现错误,并且在phpinfo()中能够显示以下内容,那么您就无需阅读后续内容了。

这里,我们已经将”可能会遇到的问题清单”整理如下。
可能会遇到的问题清单。
在php-memcached的”./configure”配置中卡住
错误1
checking for zlib location... configure: error: memcached support requires ZLIB. Use --with-zlib-dir=<DIR> to specify the prefix where ZLIB headers and library are located
我没有安装ZLIB,被怒斥了。
当出现这个错误时,可以使用以下命令解决。
yum install zlib-devel
错误2
configure: error: no, libmemcached sasl support is not enabled. Run configure with --disable-memcached-sasl to disable this check
使用 `–disable-memcached-sasl` 参数运行 configure。
我们来试着按照所说的执行命令。
./configure --disable-memcached-sasl
在安装php-memcached时遇到问题
在”make”過程中出現了錯誤。
/usr/local/src/php-memcached/php_libmemcached_compat.h:56: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'php_memcached_instance_st'
在这种情况下,问题似乎是由于使用yum安装的libmemcached版本较低。建议重新安装一次。
(参考: http://qiita.com/wata727/items/927ae072ccefe9e3de8c)
[root@test-web php-memcached]# yum remove libmemcached
[root@test-web php-memcached]# cd /url/local/src
[root@test-web src]# wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
如果有人告诉你在这里不能使用wget,请安装wget。
[root@test-web src]# yum install wget
重新振作起来,使用以下命令重新安装libmemcached。
[root@test-web src]# tar -zxvf libmemcached-1.0.18.tar.gz
[root@test-web src]# cd libmemcached-1.0.18
[root@test-web src]# ./configure --without-memcached && make && make install
无法加载memcached.so导致卡住。
当无法加载memcached.so到/usr/lib64/php/modules/目录时,将出现以下错误。
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/memcached.so' - /usr/lib64/php/modules/memcached.so: cannot open shared object file: No such file or directory in Unknown on line 0
可能原因是php.ini的设置不足。
更多详细信息,请参考这里 http://qiita.com/nnmr/items/778c3e9c4dbb7fb25a73