memcached Client, linuxmemcached_php tutorial for installing PHP under Linux

Source: Internet
Author: User
Tags php memcached

Install PHP memcached client under Linux, linuxmemcached


The following describes the Memcached client installation steps for installing PHP

1. Download and install libmemcached client
Website address: http://libmemcached.org/libMemcached.html

$wget-C https://launchpad.net/libmemcached/1.0/1.0.16/+download/libmemcached-1.0.16.tar.gz# Pro do not download 1.0.17 oh there are bug$ TAR-ZXVF LIBMEMCACHED-1.0.16.TAR.GZ$CD libmemcached-1.0.16$./configure--prefix=/usr/local/libmemcached-- With-memcached$sudo Make$sudo make Install

2. Download and install memcached
Website 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: How to write the restart Nginx and PHP script reference
PHP startup script
Nginx Startup script

4. Check whether the installation is successful
The Phpinfo () function indicates that the installation was successful if it appears as follows


Linux Install php memcached extension

You first determine whether it is memcache or memcached the difference between the two.
Telnet successfully proves that the Memcache installation was successful.
Phpinfo show memcached that's fine.

But you said
Using the official test memcached PHP file is useless, page 500 error
I wonder if you are using a code like this.
$mem = new Memcache;
$mem->connect ("192.168.x.y", 11211) or Die ("Could not Connect");

$mem->set (' key ', ' This is a test! ', 0, 60);
$val = $mem->get (' key ');
Echo $val;
?>

Take a look at the first line. $mem = new Memcache;

If your server support is memcached, it will be displayed in Phpinfo memcached
If it's memcache, it'll only show memcache.

memcached is an extension of PHP.
So you use new memcache to go to the instance memcached will be 500 also normal.

What is the relationship between Linux memcached and PHP's memcache extension

Linux memcached is the server-side
PHP Memcache is the client
Client Access server side to access data

http://www.bkjia.com/PHPjc/856990.html www.bkjia.com true http://www.bkjia.com/PHPjc/856990.html techarticle Linux installed php memcached client, linuxmemcached below will introduce the installation of PHP memcached Client Installation Step 1, download and install libmemcached client website address: Http://libmem ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.