我在ubuntu 16和PHP-7和MySQL中安装了memcached,我的web应用程序在windows中安装了xampp和PHP-5。
我想使用memcached安装在ubuntu从我的web应用程序在windows。
有可能吗?
您需要使用addServer
方法将您的服务器添加到memcached服务器池。
<?php
$m = new Memcached();
$m->addServer('UBUNTU_SERVER_IP', 11211);
?>
更多信息请查看PHP手册
示例来自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 restart