Similar to the previous article Xdebug installation Tutorial ~ ~
The difference between memcache and memcached in their new program is intended to fully apply memcached technology, which is easy to understand this is the memcached is the memory cache, but how do you still have memcache? Actually very simple, memcache is an extension of PHP, for PHP management Memcached,php-memcache.dll. If the installation of memcached does not install the extension, then PHP will not be able to control the memcached, but the command is not a problem to use the implementation of the memcache extension but did not install the memcached service, then this cannot be used You can use memcached in PHP to improve dynamic site performance only if you have both the memcached service and the memcache extension installed
One, install memcache PHP extension 1. Php_memcache.dll Download:: Php_memcache.zip http://www.2cto.com/uploadfile/2012/0713/20120713110240777.zip
2. Place the Php_memcache.dll in the PHP ext directory: For example: D:\WampServer\bin\php\php5.3.11\ext\php_memcache.dll3. Open a. php.ini file: My php.ini location: D:\WampServer\bin\php\php5.3.11\php.ini4. Add a line on php.ini: Extension=php_memcache.dll 5. Restart Wampserver Apache Service II, install memcached 1. Memcached-win64 Download: A. Download the latest version: Http://blog.couchbase.com/memcached-windows-64-bit-pre-release-available B. Direct download: Memcached-win64-1.4.4-14.zip
Http://www.2cto.com/uploadfile/2012/0713/20120713110308123.zip
2. Unzip and place under a disk, for example: D:\WampServer\bin\memcached\memcached.exe 3. Under Terminal (also known as cmd Command Interface), enter the following command to install the Windows service: D:\wampserver\bin\memcached>memcached.exe-d installation 4. Then enter the following command to start: d:\wampserver\bin\memcached>memcached.exe-d start
Ok~~ finished opening the Phpinfo () page:
=========== Code Test =============
01 |
$memcache = new Memcache; |
02 |
$memcache ->connect( "localhost" ,11211); # You might need to set "localhost" to "127.0.0.1" |
04 |
echo "Server‘s version: " . $memcache ->getVersion() . "\n" ; |
06 |
$tmp_object = new stdClass; |
07 |
$tmp_object ->str_attr = "test" ; |
08 |
$tmp_object ->int_attr = 123; |
10 |
$memcache ->set( "key" , $tmp_object ,false,10); |
11 |
echo "Store data in the cache (data will expire in 10 seconds)\n" ; |
13 |
echo "Data from the cache:\n" ; |
14 |
var_dump( $memcache ->get( "key" )); |
Results:
View Source print?
01 |
---------- PhpUnit ---------- |
02 |
Server‘s version: 1.4.4-14-g9c660c0 |
03 |
Store data in the cache (data will expire in 10 seconds) |
05 |
object(stdClass) #3 (2) { |
12 |
Output completed (2 sec consumed) - Normal Termination |
Win7 under 64-bit system memcache/memcached installation Tutorial