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.