zoukankan      html  css  js  c++  java
  • 在 Windows 10 64 下安装 Memcached,安装 PHP 7.0.22 的 Memcache 扩展

    1、之前写过一篇在 PHP 5.6.27 下的博客:http://www.shuijingwanwq.com/2017/09/11/1892/ ,此次是 PHP 7.0.22 下的,如图1

    之前写过一篇在 PHP 5.6.27 下的博客:http://www.shuijingwanwq.com/2017/09/11/1892/ ,此次是 PHP 7.0.22 下的

    图1

    2、卸载 memcached ,可以使用以下命令:,如图2
    schtasks /delete /tn memcached

    卸载 memcached

    图2

    3、删除目录:C:memcached-1.4.5,如图3

    删除目录:C:memcached-1.4.5

    图3

    4、打开网址:https://github.com/nono303/memcached/tree/master/cygwin/x64 ,下载:cygevent-2-0-5.dll、cygwin1.dll、memcached-1.5.1.exe,如图4

    打开网址:https://github.com/nono303/memcached/tree/master/cygwin/x64 ,下载:cygevent-2-0-5.dll、cygwin1.dll、memcached-1.5.1.exe

    图4

    5、下载成功后,复制至:C:memcached-1.5.1,如图5

    下载成功后,复制至:C:memcached-1.5.1

    图5

    6、以管理员身份运行 Windows PowerShell,如图6

    以管理员身份运行 Windows PowerShell

    图6

    7、执行以下命令将 memcached 添加来任务计划表中:,如图7
    schtasks /create /sc onstart /tn memcached /tr “‘C:memcached-1.5.1memcached-1.5.1.exe’ -m 512”

    执行以下命令将 memcached 添加来任务计划表中

    图7

    8、打开网址:https://github.com/nono303/PHP7-memcache-dll ,选择vc14,如图8

    打开网址:https://github.com/nono303/PHP7-memcache-dll ,选择vc14

    图8

    9、查看 phpinfo,编译器为MSVC14,且线程安全,如图9

    查看 phpinfo,编译器为MSVC14,且线程安全

    图9

    10、打开网址:https://github.com/nono303/PHP7-memcache-dll/tree/master/vc14/x64/ts ,下载:php-7.0.x_memcache.dll,如图10

    打开网址:https://github.com/nono303/PHP7-memcache-dll/tree/master/vc14/x64/ts ,下载:php-7.0.x_memcache.dll

    图10

    11、将 php-7.0.x_memcache.dll 复制至:C:php-7.0.22extphp_memcache.dll,如图11

    将 php-7.0.x_memcache.dll 复制至:C:php-7.0.22extphp_memcache.dll

    图11

    12、在 C:php-7.0.22php.ini 中添加以下行以启用memcache扩展,如图12
    extension=php_memcache.dll

    在 C:php-7.0.22php.ini 中添加以下行以启用memcache扩展

    图12

    13、查看 phpinfo,memcache已经存在,如图13

    查看 phpinfo,memcache已经存在

    图13

    14、新建测试程序:memcached.php,如图14

    新建测试程序:memcached.php

    图14

    <?php
    
    $memcache = new Memcache;
    $memcache->connect('localhost', 11211) or die ("Could not connect");
    
    $version = $memcache->getVersion();
    echo "Server's version: ".$version."<br/>
    ";
    
    $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/>
    ";
    
    $get_result = $memcache->get('key');
    echo "Data from the cache:<br/>
    ";
    
    var_dump($get_result);
    
    ?>
    

    15、在重启机器后,运行测试程序,报错:Notice: Memcache::connect(): Server localhost (tcp 11211, udp 0) failed with:,如图15

    在重启机器后,运行测试程序,报错:Notice: Memcache::connect(): Server localhost (tcp 11211, udp 0) failed with:

    图15

    16、打开任务计划程序,编辑 memcached 的触发器,从启动时修改为登录时,如图16

    打开任务计划程序,编辑 memcached 的触发器,从启动时修改为登录时

    图16

    17、此时,memcached 的触发器已经为:当任何用户登录时,如图17

    此时,memcached 的触发器已经为:当任何用户登录时

    图17

    18、在重启机器后,显示:C:memcached-1.5.1memcached-1.5.1.exe 命令行窗口,说明计划任务成功执行,如图18

    在重启机器后,显示:C:memcached-1.5.1memcached-1.5.1.exe 命令行窗口,说明计划任务成功执行

    图18

    19、运行测试程序,正常,如图19

    运行测试程序,正常

    图19

    20、希望在系统启动时,不要显示命令行窗口,更改用户或组,如图20

    希望在系统启动时,不要显示命令行窗口,更改用户或组

    图20

    21、在弹出的选择用户或组窗口中,我们选择高级 – 立即查找 – 选择 SYSTEM,点击确定,如图21

    在弹出的选择用户或组窗口中,我们选择高级 - 立即查找 - 选择 SYSTEM,点击确定

    图21

    22、运行任务时,请使用下列用户帐户,已为:SYSTEM,如图22

    运行任务时,请使用下列用户帐户,已为:SYSTEM

    图22

    23、在重启机器后,未显示:C:memcached-1.5.1memcached-1.5.1.exe 命令行窗口,且运行测试程序,正常,如图23

    在重启机器后,未显示:C:memcached-1.5.1memcached-1.5.1.exe 命令行窗口,且运行测试程序,正常

    图23

  • 相关阅读:
    Visual C++ in Visual Studio 2015
    Paxos
    dtrace
    性能测试应该怎么做?
    CLREX
    Header Field Definitions Accept-Encoding
    汇编跟逆向工程
    Optimize Managed Code For Multi-Core Machines
    Improve Scalability With New Thread Pool APIs
    CLR thread pool
  • 原文地址:https://www.cnblogs.com/aini521521/p/7765943.html
Copyright © 2011-2022 走看看