No Memcached servers added.
-
In a Laravel 5.2 application, I cannot get Memcached to work.
The initial error is the existence of the "Memcached" class. I then included memcached.php and now get "No Memcached servers added."
-
@prestonwinfrey : Did you start Memcached server? (enable it on Menu/Services and Ports)
-
Yes, the Memcached server is running.
-
The problem is: Laravel supports only Memcached
Developing PHP app with Memcached on Windows seems impossible because the PHP extension only support Memcache (note: without a d) on WindowsHowever, Laragon solves the problem. Just put the code below to where you feel convenient and it should work (Tested)
if (!class_exists('Memcached')) { include ("memcached.php"); }
For more details:
https://sourceforge.net/p/laragon/tickets/6/
-
If you want to have available memcached in all your projects in laragon put that code in a php file and include in your php.ini using:
auto_prepend_file = "C:/your_path_of_choice/enable_memcached.php"
and if you need flush, add functions edit emcached.php located at your_path_to_laragon\laragon\etc\php\pear\memcached.php and add this functions at the endpublic function flush($delay = 0) { $s = $this->writeSocket("flush_all"); if ($s == true) { $this->resultCode = Memcached::RES_SUCCESS; $this->resultMessage = ''; return true; } else { $this->resultCode = Memcached::RES_FAILURE; $this->resultMessage = 'Flush failed.'; return false; } } public function add($key, $value, $minutes) { if(!$this->get($key)) { return $this->set($key, $value, $minutes); } return false; }