CentOS 6.6 上的内存缓存
Memcached on CentOS 6.6
我正在尝试让 memcached 在 Laravel (PHP) 的 CentOS 6.6 服务器上运行。看起来我正确安装了 memcached,因为当我输入 "ps aux | grep memcached" 时,我得到的响应显示它是 运行ning。
当我 运行 phpinfo 时,我得到以下信息:
我什至有一个小脚本可以在我输入 "php test.php" 时通过命令行运行,但是当我尝试从浏览器访问它时它不起作用。这是脚本:
<?php
$mem = new Memcached();
$mem->addServer("127.0.0.1", 11211);
$result = $mem->get("blah");
if ($result) {
echo $result;
} else {
echo "No matching key found. I'll add that now!";
$mem->set("blah", "I am data! I am held in memcached!") or die("Couldn't save anything to memcached...");
}
?>
所以当从命令行 运行 时,此脚本成功缓存,但当我从浏览器 运行 时不缓存。有什么建议吗?
我仍然不知道为什么 memcached 只能从命令行运行,但我决定尝试 Redis。安装后一切正常。
我正在尝试让 memcached 在 Laravel (PHP) 的 CentOS 6.6 服务器上运行。看起来我正确安装了 memcached,因为当我输入 "ps aux | grep memcached" 时,我得到的响应显示它是 运行ning。
当我 运行 phpinfo 时,我得到以下信息:
我什至有一个小脚本可以在我输入 "php test.php" 时通过命令行运行,但是当我尝试从浏览器访问它时它不起作用。这是脚本:
<?php
$mem = new Memcached();
$mem->addServer("127.0.0.1", 11211);
$result = $mem->get("blah");
if ($result) {
echo $result;
} else {
echo "No matching key found. I'll add that now!";
$mem->set("blah", "I am data! I am held in memcached!") or die("Couldn't save anything to memcached...");
}
?>
所以当从命令行 运行 时,此脚本成功缓存,但当我从浏览器 运行 时不缓存。有什么建议吗?
我仍然不知道为什么 memcached 只能从命令行运行,但我决定尝试 Redis。安装后一切正常。