PHP cannot operate memcache

Source: Internet
Author: User
I phpinfo () inside the show has memcache memcached service also played why PHP code or can not operate memcache? Do not know where to troubleshoot the problem, in this consult, first thanked.
$memcache = new Memcache ();//var_dump ($memcache->connect (' localhost ', 11211);d ie;if (! $memcache->connect (' localhost ', 11211)) Die  (' could not Connect '), $memcache->set (' key ', ' test '), $get _value = $memcache->get (' Key '); Echo $get _value;       

Web Access this PHP returns absorted status


Reply to discussion (solution)

Phpinfo () It shows Memcache, memcached service.

Memcache and memcached are different.

The background process confirms that the server side is working properly

Phpinfo () It shows Memcache, memcached service.

Memcache and memcached are different.




Memcache is a client, memcached is a service-side service
I said Phpinfo () inside the show has memcache, is to express the PHP memcache extension I have installed.
Now the problem is the expansion of the load, the service is up, PHP still can't operate memcache~

The background process confirms that the server side is working properly



I have confirmed that the server is normal.
I use Telnet localhost 11211 to connect the memcache normally and to store read operations.

PHP is unable to manipulate memcache when it comes to the problem.

The absorted state should be the client disconnected, not the service end you're open.
Multiple occurrences with the browser

PHP code is not like this.
We recommend that you first make sure that the error check for PHP is not turned off and that the error display is open

The absorted state should be the client disconnected, not the service end you're open.
Multiple occurrences with the browser

PHP code is not like this.
We recommend that you first make sure that the error check for PHP is not turned off and that the error display is open



 
  Connect (' localhost ', 11211)) Die  (' could not Connect '), $memcache->set (' key ', ' test '), $get _value = $memcache- >get (' key '); Echo $get _value;


Plus the fifth line Die (); The browser is not absorted state, return object (Memcache) #1 (0) {}
After the subsequent debugging found the problem in $memcache->connect here, this section led to the absorted bar

Change the localhost to 127.0.0.1 look.

In addition Echo $memcache->getversion ();
You can see if it's normal.

In addition Echo $memcache->getversion ();
You can see if it's normal.



It's the same mistake to change to localhost.
$memcache = new Memcache ();
echo $memcache->getversion ();

This will be out: Warning:memcachepool::getversion (): No servers added to memcache connection on XXX line 5
I try $memcache = new Memcache (); $memcache->addserver (' 127.0.0.1 ', 11211); Still absorted

$memcache = new Memcache ();
$memcache->connect (' localhost ', 11211);
echo $memcache->getversion ();
If it's not connected, it will be an error.

I've re-made a stable version of Memcache to solve the problem.

Download Address: Http://pecl.php.net/package/memcache

  • 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.