我已经用PHP-7和MySQL在ubuntu16中安装了memcached,我的web应用程序在windows中,我用PHP-5安装了xampp。
我想在windows的web应用程序中使用安装在ubuntu中的memcached。
有可能吗?
发布于 2016-10-27 13:51:06
您需要使用addServer方法将您的服务器添加到memcached服务器池。
<?php
$m = new Memcached();
$m->addServer('UBUNTU_SERVER_IP', 11211);
?>有关更多信息,请查看Memcached::addServer on PHP Manual
发布于 2016-10-27 14:12:36
PHP手册中的示例:
<?php
$m = new Memcached();
/* Add 2 servers, so that the second one
is twice as likely to be selected. */
$m->addServer('mem1.domain.com', 11211, 33);
$m->addServer('mem2.domain.com', 11211, 67);
?>更多信息:PHP:Memcached
之后,别忘了在/etc/memcached.conf (Ubuntu)中修改
# Specify which IP address to listen on. The default is to listen on all IP addresses
# This parameter is one of the only security measures that memcached has, so make sure
# it's listening on a firewalled interface.
-l 127.0.0.1至
-l 0.0.0.0然后
/etc/init.d/memcached restarthttps://stackoverflow.com/questions/40276927
复制相似问题