How do I test if memcache or memcached (for PHP) is installed on my Apache webserver?
Memcache is a caching daemon designed especiall
Note that all of the class_exists, extensions_loaded, and function_exists only check the link between PHP and the memcache package.
To actually check whether memcache is installed you must either:
EDIT 2: OK, actually here's an easier complete solution:
if (class_exists('Memcache')) {
$memcache = new Memcache;
$isMemcacheAvailable = @$memcache->connect('localhost');
}
if ($isMemcacheAvailable) {
//...
}
EDIT: Actually you must force PHP to throw error on warnings first. Have a look at this SO question answer.
You can then test the connection via:
try {
$memcache->connect('localhost');
} catch (Exception $e) {
// well it's not here
}