When compiling the memcached extension, you have to specify the location of the Libmemcached library
--with-libmemcached-dir=dir to specify the path. This path is the value of the prefix specified when installing libmemcached
So we have to install the Libmemcached library first.
First, install the libmemcached library
Why does the libmemcached library compile unsuccessfully, as if it requires a later version of the GCC compiler?
As I said online, I did the following:
Yum Install gcc44 gcc44-c++ libstdc++44-devel
The reason seems to be that the GCC version is too low
Countermeasure: Upgrade compiler version above libmemcached-1.0.2 version
# yum Install gcc44 gcc44-c++ libstdc++44-devel
# Export CC=/USR/BIN/GCC44
# Export CXX=/USR/BIN/G++44
#./configure
Question: What does cc and cxx say?
CC represents the GCC compiler. CXX represents the g++ compiler (for C + + source code)
After the installation is successful, assume that the library is installed in the following location:/usr/local/libmemcached-1.0.18/
Second, compile memcached extension
After installing the library, compile the memcached extension now.
Access to the memcached source directory
CD memcached-2.0.0
/usr/local/php/php-5.5.18/bin/phpize #去源码目录下执行phpize to generate a configure file in the current directory
./configure--with-php-config=/usr/local/php/php-5.5.18/bin/php-config--with-libmemcached-dir=/usr/local/ libmemcached-1.0.18/
Make
Make install this step will automatically copy the generated. So extension file to the PHP extension directory
Third, modify the php.ini
This is a simple step in adding the memcached.so extension. Needless to say.
Extra: Compiling memcache extensions (without D) is also the same operation. This extension relies on the Libmemcache library (also without D). Currently, memcached extensions are generally used, and the function is more complete.
Compile and install memcached extensions