Reputation: 111
I need to use Memcached in XAMPP because I need to develop locally, and all solutions i've seen so far, dont work.
Fatal error: Class 'Memcached' not found in /Applications/XAMPP/xamppfiles/htdocs/system/libraries/Session/drivers/Session_memcached_driver.php on line 108
A PHP Error was encountered
Severity: Error
Message: Class 'Memcached' not found
Filename: drivers/Session_memcached_driver.php
Line Number: 108
Backtrace:
//does not work, and actually i need this not the bottom one.
//keep in mind that the service is running, and everything was succesfully
//installed with brew
$this->_memcached = new Memcached();
//works
$this->_memcached = new Memcache;
Upvotes: 2
Views: 4219
Reputation: 877
This is what worked for me:
Install libmemcached with brew:
brew install libmemcached
Install memcached with pecl:
sudo /Applications/XAMPP/xamppfiles/bin/pecl install memcached
Add the memcached extension to your php.ini file:
sudo vim /Applications/XAMPP/xamppfiles/etc/php.ini
Restart your Apache server (either use the GUI or run):
sudo apachectl restart
Start memcached with brew:
brew services start memcached
Created a gist with these instructions.
Upvotes: 4
Reputation: 111
Found the solution :)
brew install libevent
brew install autoconf
brew install libmemcached
//Download the PHP version you are using and past it to:
cd /Applications/MAMP/bin/php/php5.6.7/include/php
//Configure the source with
/Applications/MAMP/bin/php/php5.6.7/include/php/configure
//go to
cd /Applications/MAMP/bin/php/php5.6.7/bin
//compile memcached
./pecl install memcached
//go back
cd ../
//Add the memcached.so extension to your php.ini file
echo -e "\n[memcached]\nextension=memcached.so" >> conf/php.ini
//start memcached server
memcached -m 24 -p 11211 -d
//restart MAMPP and thats it!
Upvotes: 2