Install the php memcached client in linux, and use linuxmemcached. Install the memcached client of php in linux. install the memcached client of php in linuxmemcached. step 1. download and install the memcached client of libmemcached.
The following describes how to install the memcached client of php.
1. download and install the libmemcached client
Address: http://libmemcached.org/libMemcached.html
$ Wget-c https://launchpad.net/libmemcached/1.0/1.0.16/javasdownload/libmemcached-1.0.16.tar.gz?do not download 1.0.17 Oh bug $ tar-zxvf libmemcached-1.0.16.tar.gz $ cd libmemcached-1.0.16 $. /configure -- prefix =/usr/local/libmemcached -- with-memcached $ sudo make install
2. download and install memcached
Address: http://pecl.php.net/package/memcached
$wget -c http://pecl.php.net/get/memcached-2.2.0b1.tgz$tar -zxvf memcached-2.2.0b1.tgz$cd memcached-2.2.0b1$sudo /usr/local/php/bin/phpize$./configure --enable-memcached --with-php-config=/usr/local/php/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached --disabled-memcached-sasl$sudo make$sudo make install
3. restart php nginx
$sudo /etc/init.d/nginx restart$sudo /etc/init.d/php restart
Note: for how to compile a restart nginx and php script, refer
Php startup script
Nginx startup script
4. check whether the installation is successful.
If the phpinfo () function appears as follows, the installation is successful.
Install the memcached extension of PHP in linux
First, determine whether it is memcache or memcached.
Telnet successfully proves that memcache is successfully installed.
Phpinfo shows memcached, which is okay.
But you said
It is useless to use the official PHP file for memcached testing. The Error 500 is displayed on the page.
I wonder if you are using such code.
$ Mem = new Memcache;
$ Mem-> connect ("192.168.x.y", 11211) or die ("cocould not connect ");
$ Mem-> set ('key', 'This is a test! ', 0, 60 );
$ Val = $ mem-> get ('key ');
Echo $ val;
?>
Pay attention to the first line .. $ Mem = new Memcache;
If your server supports memcached, memcached is displayed in phpinfo.
For memcache, only memcache is displayed.
Memcached is an extension of php.
Therefore, if you use new memcache to go to the instance memcached, it will take 500 of the total output.
What is the relationship between Linux memcached and php memcache extensions?
In Linux, memcached is a server.
Php memcache is a client
The client accesses the server to access data.
Steps 1. download and install the libmemcached client: http: // libmem...