The server is CENTOS6 64,php5.4.23, and you need to install the PHP memcached extension
Attempt to install using PECL:
# yum Install libmemcached libmemcached-devel zlib-devel
# yum-y Install Php-pear
# pecl Install memcached
But an error occurred:
In the file containing the/var/tmp/memcached/php_memcached.h:22, from/var/tmp/memcached/php_memcached.c:47:
/VAR/TMP/MEMCACHED/PHP_LIBMEMCACHED_COMPAT.H:5:40: Error: libmemcached-1.0/memcached.h: no file or directory
The above obvious php_libmemcached_compat.h file can not find the memcached.h, so download the package, a look at the following:
# wget Http://pecl.php.net/get/memcached
# MV Memcached memcached.tar.gz
# tar zxf memcached.tar.gz
# CD MEMCACHED-2.2.0B1/
# VI Php_libmemcached_compat.h
#ifndef Php_libmemcached_compat
#define Php_libmemcached_compat
19
/* This is the version (s) We support * *
#include <libmemcached/memcached.h>
See above contains libmemcached/memcached.h, but in fact memcached.h files are located at:
# Find/usr-name Memcached.h
/usr/include/libmemcached/memcached.h
Then modify the path above to the normal path:
#ifndef Php_libmemcached_compat
#define Php_libmemcached_compat
19
/* This is the version (s) We support * *
#include </usr/include/libmemcached/memcached.h>
After saving, use Phpize to compile:
Configure:error:no, Sasl.h is not available. Run Configure with--DISABLE-MEMCACHED-SASL to disable this check
Cyrus-sasl-devel
Had to add the--DISABLE-MEMCACHED-SASL, again, but there are still errors:
#./configure--DISABLE-MEMCACHED-SASL
... Omitted...
In file included From/root/download/memcached-2.2.0b1/php_memcached_private.h:28,
FROM/ROOT/DOWNLOAD/MEMCACHED-2.2.0B1/PHP_MEMCACHED.C:26:
/ROOT/DOWNLOAD/MEMCACHED-2.2.0B1/PHP_LIBMEMCACHED_COMPAT.H:53: Error: expected ' = ', ', ', '; ', ' asm ' or ' __attribute__ ' Before ' Php_memcached_instance_st '
... Omitted...
It seems blocked, only manually compiled libmemcached to try.
The following is a manual compilation of libmemcached and PHP memcached extensions
1. Uninstall the libmemcached of the Yum installation first
# yum Remove libmemcached libmemcached-devel
2. Download the source package
# CD ...
# wget https://launchpad.net/libmemcached/1.0/1.0.17/+download/libmemcached-1.0.17.tar.gz
# tar zxf libmemcached-1.0.17.tar.gz
# CD libmemcached-1.0.17
#./configure
# make
# make Install
Successfully installed libmemcached.
3. Next install memcached, first find memcached.h header file where, need to set the correct include path in php_libmemcached_compat.h
# CD ... /memcached-2.2.0b1
# Find/-name Memcached.h
/root/download/libmemcached-1.0.17/libmemcached/memcached.h
/root/download/libmemcached-1.0.17/libmemcached-1.0/struct/memcached.h
/root/download/libmemcached-1.0.17/libmemcached-1.0/memcached.h
/root/download/libmemcached-1.0.17/libtest/memcached.h
/root/download/mysql-5.6.15/plugin/innodb_memcached/daemon_memcached/daemon/memcached.h
/usr/local/include/libmemcached/memcached.h
/usr/local/include/libmemcached-1.0/struct/memcached.h
/usr/local/include/libmemcached-1.0/memcached.h
4. Modify the include path in the Php_libmemcached_compat.h file under Memcached-2.2.0b1 to the correct path:
#ifndef Php_libmemcached_compat
#define Php_libmemcached_compat
19
/* This is the version (s) We support * *
#include </usr/local/include/libmemcached/memcached.h>
5. Start compiling and installing PHP memcached extensions:
# phpize
#./configure
# make
... Omitted...
Build complete.
Don ' t forget to run ' make test '.
# make Install
Installing Shared extensions:/usr/lib64/php/modules/
6. See if memcached.so has been generated:
# ls/usr/lib64/php/modules/
bcmath.so gd.so memcached.so mysql.so phar.so sysvsem.so xcache.so xsl.so
curl.so json.so memcache.so pdo_mysql.so posix.so sysvshm.so xmlreader.so zip.so
dom.so mbstring.so mysqli.so pdo.so sqlite3.so tidy.so xmlrpc.so
fileinfo.so mcrypt.so mysqlnd_memcache.so pdo_ sqlite.so sysvmsg.so wddx.so xmlwriter.so