Memcache and Membached extensions not bundled with PHP?

I never knew this was the true, but now it seems to be a problem. As a software developer, I cannot assume all my client users are on hosting services that enable PECL extensions installation. Since Memcache and Memcached both require installation through PECL, this is becoming a headache. For those of you developing commercial/free softwares, how do you resolve this problem? Is it possible to achieve good caching without Memcache/Memcached? If so, what are the alternatives?

Maybe the PEAR Cache Lite package?

There are a lot of options. You can use Memcache, Apc, XCache (windows only), MySQL, a key/value store like MongoDB, Redis, etc, PHP arrays (not as effective as they are gone once the request stops, but within the request they can speed things up), or even flat files.

The most modular thing to do is write a caching mechanism on a higher level, that has “adapters” for different services. Depending on what’s available on the server, use a different adapter.

A good example of this is how lithium (li3) does it. See http://lithify.me/docs/lithium/storage/Cache

I thought Memcache and APC are not bundled with PHP and requires PECL installation, while as a software developer you cannot assume users all have Memcache or APC enabled. Unless you are talking about a different Memcache/APC than I know of? Weird…

No we’re talking about the same thing. What I suggest is checking the server when your app starts and then use a mechanism that is available.
So first check if Memcache is available (using class_exists). If it is available, use it. If not, check if APC is available. If it is, use it. If not, check for the next thing. And so on and so forth.

I see, thanks for your explanation. I guess most shared hosts will not have Memcache, although I wonder how many of them enable APC. What do you mean by MySQL though? Its not a caching system, is it?

Most of the good ones have one or another, though like hosting it will be a shared resource and not a dedicated instance.

Its an RDBMS but you can use it for caching as well if none of the usual caching engines work. You can create a memory based table to cache data (like you would in an in-memory storage like MongoDB, or Memcached etc), just be sure not to store ton of it as shared hosting accounts have a strict limitation on how much RAM they can juice off. If memory storage is not available in MySQL then you can just go for a regular MyISAM based table and store key-value pairs.