APC(可变缓存)替代PHP作为CGI运行


APC (variable cache) alternative for PHP running as CGI

我想知道除了APC缓存之外,还有什么其他简单易用的PHP缓存机制可以很好地与作为CGI运行的PHP配合使用。

配置命令
'./configure' '--prefix=/usr/local/php5' '--enable-force-cgi-redirect' '--enable-fastcgi' '--with-config-file-path=/usr/local/etc/php5/cgi' '--with-curl=/usr/local/lib' '--with-gd' '--with-gettext' '--with-jpeg-dir=/usr/local/lib' '--with-freetype-dir=/usr/local/lib' '--with-kerberos' '--with-openssl' '--with-mcrypt' '--with-mhash' '--with-mysql=/usr' '--with-mysqli=/usr/bin/mysql_config' '--with-pcre-regex=/usr/local' '--with-pdo-mysql=/usr' '--with-pear' '--with-png-dir=/usr/local/lib' '--with-zlib' '--with-zlib-dir=/usr/local/lib' '--enable-zip' '--enable-gd-native-ttf' '--with-iconv=/usr/local' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-mbstring'

服务器API CGI/FastCGI

我正在寻找的是一个简单的内存缓存系统,它允许我存储变量,设置TTL,然后从内存中检索它们。我不是在寻找操作码缓存。

注意:我无法切换到PHP CLI或其他SAPI。我也尝试过在这个环境中安装APC,它只根据请求工作(刷新时无法访问)。

您可能正在寻找Memcachedhttp://www.memcached.org/

PHP有一个模块:http://php.net/manual/en/book.memcached.php

如果你说你不能切换到fcgi/fpm,我假设你没有对服务器的root访问权限(如果这个假设是错误的,那么请切换,它不仅可以使APC工作,而且可以提高总体性能。)

所以我唯一能想到的就是使用MySQL。MySQL有存储在RAM中的MEMORY表。您可以很容易地在此基础上构建一个key=>值缓存。显然,这不会提供与APC相同的性能,但也许它足以满足您的情况。