Reputation: 6765
I've just installed Memcache in XAMPP on OS X Mountain Lion and I'm trying to run it using:
$memcache = new Memcache();
$memcache>connect('127.0.0.1', 11211) or die ("Could not connect");
This returns:
Fatal error: Class 'Memcache' not found in /Applications/XAMPP/xamppfiles/htdocs/mysite/myfile.php on line 123
What can I do to fix this?
I installed Memcache using this guide
In my php.ini file I have extension="memcache.so"
In phpinfo.php I have mod_mem_cache
Upvotes: 0
Views: 509
Reputation: 21
First off, check that your syntax is correct. You are missing a pointer in the example code that you've submitted. "->". Also, I am unable to check if the connection is successful or not by using "or die", therefor I usually check the connection object itself.
$memcache = new Memcache();
$memcache->connect('127.0.0.1', 11211);
if ($memcache === FALSE){
echo 'Unable to connect to memcache';
}
If this does not work, then check that you really do have memcache available. Open up a terminal on your OSX and run:
php --info | grep '^memcache'
Upvotes: 1