如何在php中使用memcached(安装在不同的服务器中)

I have installed memcached in ubuntu 16 with PHP-7 and MySQL and my web application is in windows where I installed xampp with PHP-5.

I want to use memcached installed in ubuntu from my web application in windows.

Is it possible?

You need to add your server to memcached server pool with addServer method.

<?php
    $m = new Memcached();
    $m->addServer('UBUNTU_SERVER_IP', 11211);
?>

for more information please check Memcached::addServer on PHP Manual

Example from PHP Manual:

<?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);
?>

More informations: PHP:Memcached

After this don't forget to change in /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

to

-l 0.0.0.0

and then

/etc/init.d/memcached restart