I have installed memcached binary file in Windows 7 and started it as server.
When I type wmic process get description, exetuablepath | findstr memcached.exe I get t
Based on the comments, I assume you have not downloaded and installed memcached, but have successfully installed the memcached module for PHP. Basically, you've gotten the car keys, but don't have the car.
memcached is built for Linux, but it has been ported by others to Windows. This tutorial is old, but it might be what you're looking for: http://www.codeforest.net/how-to-install-memcached-on-windows-machine
This is for future vistors!
You can get the php extension "memcache" to use memcached with php on windows here http://downloads.php.net/pierre/
Memcached is the server daemon and you can get it for windows here http://splinedancer.com/memcached-win32/
A note to anyone who runs into issues with getting memcached working on Windows.
Your composer.json
should have ext-memcached
listed in it but it won't install, it'll just throw an error if it's missing. Here's various ways to get it:
AFAIK as of 2018 there is no binary Windows port of JUST Memcached for PHP 7 But there is a pre-packaged version in Laragon or alternatively Winginx
There's a handful of people offering compiled DLLs on github (64-bit, and thread-safe offered)
ubuntu
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt install php-memcached
Restart php fpm if using it sudo service php7.2-fpm restart
You can compile the php bindings but the windows package of memcached has been broken for 4 years (as of 2018)
Here's a dirty wrapper around Memcached called StaticCache you can use in a pinch to read/write values from disk. It's obviously way slower than memcached so it's only meant to be a shoe-in for Windows development. If you get fancy, you could define this as a polyfill by the same name
function StaticCacheClear()
{
foreach (scandir(sys_get_temp_dir()) as $file) {
if (StringBeginsWith($file, "staticcache"))
{
$path = sys_get_temp_dir() ."/". $file;
unlink($path);
}
}
global $Memcache;
if ($Memcache) $Memcache->flush();
}
// REMOVE if you don't want a global way to clear cache
if (isset($_GET['clear_static_cache'])) {
StaticCacheClear();
}
function MemcacheGet($key)
{
global $Memcache;
$value = $Memcache ? $Memcache->get($key) : (file_exists($key)?file_get_contents($key):null);
return !$Memcache? $value : (Memcached::RES_NOTFOUND === $Memcache->getResultCode() ? null : $value);
}
function StaticCacheKey($key)
{
global $Memcache;
$cacheVersion = "MY_APP_VERSION_HERE";
$uniqueKey = "staticcache_{$key}_" . date("Ymd") . "$cacheVersion.cache";
$filename = sanitize_file_name($uniqueKey);
$filename = sys_get_temp_dir() . '/' . $filename;
return $Memcache ? $uniqueKey : $filename;
}
function StaticCacheWrite($key, $value)
{
global $Memcache;
if (isset($_GET['disable-cache'])) return null;
if ($Memcache)
$Memcache->set(StaticCacheKey($key), serialize($value));
else
file_put_contents(StaticCacheKey($key), serialize($value));
}
function StaticCacheRead($key)
{
global $Memcache;
$key = StaticCacheKey($key);
$value = MemcacheGet($key);
return $value !== null ? unserialize($value) : null;
}