1. I previously wrote a blog post about PHP 5.6.27: https://www.shuijingwanwq.com/2017/09/11/1892/ , and this time it is for PHP 7.0.22, as shown in Figure 1

2. To uninstall memcached, you can use the following command: , as shown in Figure 2
schtasks /delete /tn memcached

3. Delete the directory: C:\memcached-1.4.5, as shown in Figure 3

4. Open the URL: https://github.com/nono303/memcached/tree/master/cygwin/x64 , and download: cygevent-2-0-5.dll, cygwin1.dll, memcached-1.5.1.exe, as shown in Figure 4

5. After downloading successfully, copy the files to: C:\memcached-1.5.1, as shown in Figure 5

6. Run Windows PowerShell as an administrator, as shown in Figure 6

7. Execute the following command to add memcached to the Task Scheduler: , as shown in Figure 7
schtasks /create /sc onstart /tn memcached /tr “‘C:\memcached-1.5.1\memcached-1.5.1.exe’ -m 512”

8. Open the URL: https://github.com/nono303/PHP7-memcache-dll , and select vc14, as shown in Figure 8

9. Check phpinfo; the compiler is MSVC14 and it is thread-safe, as shown in Figure 9

10. Open the URL: https://github.com/nono303/PHP7-memcache-dll/tree/master/vc14/x64/ts , and download: php-7.0.x_memcache.dll, as shown in 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

12. Add the following line in C:\php-7.0.22\php.ini to enable the memcache extension, as shown in Figure 12
extension=php_memcache.dll

13. Check phpinfo; memcache is now present, as shown in Figure 13

14. Create a new test program: memcached.php, as shown in Figure 14

<?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);
?>15. After restarting the machine, running the test program throws an error: Notice: Memcache::connect(): Server localhost (tcp 11211, udp 0) failed with: , as shown in Figure 15

16. Open the Task Scheduler, edit the trigger for memcached, and change it from “At startup” to “At log on”, as shown in Figure 16

17. At this point, the trigger for memcached is now set to: “At log on of any user”, as shown in Figure 17

18. After restarting the machine, the C:\memcached-1.5.1\memcached-1.5.1.exe command-line window appears, indicating that the scheduled task executed successfully, as shown in Figure 18

19. Run the test program; it works normally, as shown in Figure 19

20. I want the command-line window not to appear when the system starts, so I change the user or group, as shown in Figure 20

21. In the “Select User or Group” window that pops up, we select Advanced – Find Now – select SYSTEM, and click OK, as shown in Figure 21

22. “When running the task, use the following user account:” is now set to: SYSTEM, as shown in Figure 22

23. After restarting the machine, the C:\memcached-1.5.1\memcached-1.5.1.exe command-line window is not displayed, and running the test program works normally, as shown in Figure 23

