user562854
user562854

Reputation:

APC (variable cache) alternative for PHP running as CGI

I am wondering what other simple-to-use caching mechanisms exist for PHP, except APC cache, that work fine with php running as CGI.

Configure Command
'./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'

Server API CGI/FastCGI

What I am looking for is a simple memory caching system, that allows me to store variables, set TTL, and then retrieve them from memory. I am NOT looking for opcode cache.

NOTE: I cannot switch to PHP CLI or other SAPI. I've also tried installing APC on this environment and it works just per request (can not be accessed on refresh).

Upvotes: 1

Views: 848

Answers (2)

Martin Samson
Martin Samson

Reputation: 4090

You are probably looking for Memcached http://www.memcached.org/

PHP has a module for it: http://php.net/manual/en/book.memcached.php

Upvotes: 4

NikiC
NikiC

Reputation: 101946

Given that you say that you can't switch to fcgi/fpm I assume that you don't have root access to your server (if this assumption is wrong, then please, just switch, it will not only make APC work but also improve the performance in general.)

So the only thing that I can think of is just using MySQL for this. MySQL has MEMORY tables which are stored in RAM. You could easily build a key => value cache on top of that. Obviously this won't deliver the same performance as APC, but maybe it suffices for your case.

Upvotes: 3

Related Questions