PHP Extended memcache Module

Source: Internet
Author: User
When studying the components that Yii supports, I find that PHP does not support the Memcache module, so I try to expand it.


Native Environment: win8.1


Development environment: PHP 5.5


  • The first step: first to download the required file package completely, I have packaged it, here can download.

  • There are two main files in the package: Php_memcache.dll and Memcached-win64 ps:memcached are 64-bit installed


  • Step Two: Install the memcached installation package

  • Unzip the installation package under a disk:

    E:\wamp\bin\memcached\memcached.exe


    Then install the Windows service by entering the following command at the terminal (also known as the cmd Command interface):

    Note: This must be Administrator privileges Oh, otherwise there is no way to install

    e:\wamp\bin\memcached>memcached.exe-d Install

    Then enter the following command to start:

    e:\wamp\bin\memcached>memcached.exe-d start


    This completes the installation memcache.


  • Step three: Install the PHP extension memcache

  • First put the downloaded php_memcache.dll into the PHP ext directory:

    Example: E:\Wamp\bin\php\php5.3.11\ext\php_memcache.dll

    Open php.ini File:

    My php.ini is here: E:\Wamp\bin\php\php5.3.11\php.ini

    Add a line to the php.ini:

    Extension=php_memcache.dll

    Restart Wampserver's Apache service


  • Fourth step: View Phpinfo ();
  • Fifth Step: Test memcache
  • Test code:

      
       Connect (' 127.0.0.1 ', 11211) or Die ("Could not Connect"); Connect memcached server $memcache->set (' key ', ' This is a memcache test! ', memcache_compressed, 50); Set a variable into memory, the name is the key value is Test$get_value = $memcache->get (' key '); Remove the value of key from memory echo $get _value;echo '
    Server version: '. $memcache->getversion ();? >

    Test results:

    This is a memcache test! Server version:1.4.4-14-g9c660c0
    The PHP memcache extension has been successfully completed.
  • 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.