Today modified a long time ago a program, found that the new concept of data operation is far more complex than before, the original caching mechanism is not good, and do not cache the frequent reading of the data is too scary, so began to consider using memcache for caching.
Because need to test in this machine, so need to install memcache in My computer, but on the official website of Memcache, but can't find the download of the Windows version, check the data for a long time, Just know that there is a memcache called Windows stable version of the thing (many articles on the internet are wantonly reproduced, only to say download Windows stable version, and did not provide download address, Pit dad),
It seems not official, but running on Windows is not a problem, it is downloaded, stored in any directory, preferably pure English, such as I put in d:memcached, then start the command-line tool, Win7 or WIN8 user attention, the following operations require administrator rights, so directly in the "Run" Input "cmd" is not successful, you need to be found in the "Start Menu"-> "" Command prompt, right-click-> to run as administrator, or find Cmd.exe in C:windowssystem32, right-click-> Run as Administrator.
Use the CD command to locate Memcache.exe's storage directory, such as CD d:memcached. CMD program is located in the default C disk, running the above line command is not directly to switch, but also to enter "D:" Switch to D disk (seemingly so simple things do not need??) Aluminum tax larr;_←). Then enter the following command to install:
Of course, you can also directly enter the full path, so you do not need to locate, such as: d:memcachedmemcached.exe-d Install (Good??? larr;_←). Start the service with the following command after installation:
Next download Php_memcache.dll, download the address:
Find Php_memcache, download it. This page provides two versions, seemingly all only support PHP5.3, use the other PHP version of children's shoes if not, try to look elsewhere. Here I downloaded the php_memcache-2.2.6-5.3-vc9-x86.zip, and the other php_memcache-2.2.6-5.3-nts-vc9-x86.zip didn't work with my PHP version.
Download the unpacked folder after extracting it in the PHP installation directory, then modify PHP.ini, add Extension=php_memcache.dll.
Restart Apache (or Balabala, such as IIS, Nginx), open view phpinfo (this I don't?? Aluminum larr;_←), if you can find memcache, that means the installation is successful, if not, check if your Php_memcache.dll version is right, to see if the Memcache installation is successful or the service is started and so on.
OK, now you can use Memcache in PHP if the output "This is a test!" Indicates that the configuration was successful.
|code is as follows||copy code|