The content of this article is to install Memcached and install the Memcache extension of PHP 7.0.22 under Windows 10 64. Now I share it with you. Friends in need can refer to it
1. I have written a blog before under PHP 5.6.27: http://www.shuijingwanwq.com/2017/09/11/1892/, this time it is under PHP 7.0.22, as shown in the figure 1
##Figure 1
2. To uninstall memcached, you can use the following command: as shown in Figure 2
schtasks /delete /tn memcached
Figure 2
3. Delete the directory: C:\memcached-1.4.5, as shown in Figure 3
Figure 3
4. Open the URL: https://github.com/nono303/memcached/tree/master/cygwin/x64, download: cygevent-2-0-5.dll, cygwin1.dll , memcached-1.5.1.exe, as shown in Figure 4
Figure 4
5. After successful download, copy to: C:\memcached-1.5 .1, as shown in Figure 5
Figure 5
6. Run Windows PowerShell as an administrator, as shown in Figure 6
Figure 6
#7. Execute the following command to add memcached to the task schedule: as shown in Figure 7
schtasks /create /sc onstart /tn memcached /tr “'C :\memcached-1.5.1\memcached-1.5.1.exe' -m 512”
Figure 7
8. Open the URL: https: //github.com/nono303/PHP7-memcache-dll, select vc14, as shown in Figure 8
##Figure 8
9. View phpinfo, compiler It is MSVC14 and thread-safe, as shown in Figure 9
Figure 9
10. Open the URL: https://github.com/nono303/PHP7- memcache-dll/tree/master/vc14/x64/ts, download: php-7.0.x_memcache.dll, as shown in Figure 10
Figure 10
11. Copy php-7.0.x_memcache.dll to: C:\php-7.0.22\ext\php_memcache.dll, as shown in Figure 11
##Figure 11
12. Add the following lines in C:\php-7.0.22\php.ini to enable the memcache extension, as shown in Figure 12
extension=php_memcache.dll
Figure 12
13. Check phpinfo, memcache already exists, as shown in Figure 13
Figure 13
14. Create a new test program: memcached.php, as shown in Figure 14
##Figure 14
12345 6789101112131415161718192021
|
<?php
$memcache = new Memcache;
$memcache->connect('localhost', 11211) or die ("Could not connect");
$version = $memcache->getVersion();
echo "Server's version: ".$version."<br/>\n";
$tmp_object = new stdClass;
$tmp_object->str_attr = 'test';
$tmp_object->int_attr = 123;
$memcache->set('key', $tmp_object, false, 10) or die ("Failed to save data at the server");
echo "Store data in the cache (data will expire in 10 seconds)<br/>\n";
$get_result = $memcache->get('key');
echo "Data from the cache:<br/>\n";
var_dump($get_result);
?> Copy after login
|
15. After restarting the machine, run the test program and an error message is reported: Notice: Memcache::connect(): Server localhost (tcp 11211, udp 0) failed with:, as shown in Figure 15
Figure 15
16. Open the task scheduler, edit the trigger of memcached, and change it from startup to login, as shown in Figure 16
Figure 16
17. At this time, the trigger of memcached is: when any user logs in, as shown in Figure 17
Figure 17
18. After restarting the machine, the C:\memcached-1.5.1\memcached-1.5.1.exe command line window is displayed, indicating that the planned task was successfully executed, as shown in Figure 18
Figure 18
19. Run the test program, normal, as shown in Figure 19
Figure 19
20. It is hoped that when the system starts, the command line window will not be displayed and the user or group will be changed, as shown in Figure 20
Figure 20
21. In the pop-up Select User or Group window, we select Advanced – Find Now – select SYSTEM and click OK, as shown in Figure 21
##Figure 2122. When running the task, please use the following user account, which is: SYSTEM, as shown in Figure 22
##Figure 22
23. Restart the machine After that, the C:\memcached-1.5.1\memcached-1.5.1.exe command line window is not displayed, and the test program is run, and it is normal, as shown in Figure 23
Related recommendations:
Compile php7.2 under windows and extend judy
php configuration and instructions for extending redis under windows
How to build Apache PHP environment under Windows
The above is the detailed content of Installing Memcached under Windows 10 64 and installing the Memcache extension for PHP 7.0.22. For more information, please follow other related articles on the PHP Chinese website!