【问题标题】:Memcached on CentOS 6.6CentOS 6.6 上的内存缓存
【发布时间】:2015-02-11 01:29:50
【问题描述】:

我正在尝试让 memcached 在 Laravel (PHP) 中的 CentOS 6.6 服务器上工作。看起来我正确安装了 memcached,因为当我输入“ps aux | grep memcached”时,我得到一个显示它正在运行的响应。

当我运行 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...");
}
?>

所以这个脚本在从命令行运行时成功缓存,但在我从浏览器运行时不缓存。有什么建议吗?

【问题讨论】:

  • 虽然这与编程有关,但您可能会在Server Fault 上得到更好的回复。

标签: php laravel-4 memcached centos6.5


【解决方案1】:

我仍然不知道为什么 memcached 只能从命令行运行,但我决定尝试 Redis。安装后,一切正常。

【讨论】:

    猜你喜欢
    • 2015-10-01
    • 2015-03-14
    • 2015-04-13
    • 1970-01-01
    • 1970-01-01
    • 2014-03-16
    • 2010-10-27
    • 1970-01-01
    • 2017-01-05
    相关资源
    最近更新 更多