How to install Memcached on Windows machine

After some research I found that there is a Win32 binary version of memcached available here.

So go there and download win32 binary version to your computer. When downloaded, extract the file to folder memcahced on your C partition.

You should get only one file named memcached.exe. Now we need to install this as a service, as memCached is daemon and should be run only as service.

To install Memcached as a service, follow these steps (please change all forward slashes to backslashes):

  1. If you’re running Vista, you should set memcached.exe to Run as administrator
  2. Install the service using the command:
    1 c:/memcached/memcached.exe  -d install

    from the command prompt

  3. Start the server from the Services or by running one of the following commands:
    1 c:/memcached/memcached.exe -d  start


    1 net start "memcached Server"

That is it, now your memcached server is installed and is listening to port 11211. There is one more thing left to do. By default, server is set to 64Mb memory limit, which is too small. To correct, go to Registry Editor and find key

1 HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/memcached  Server .

Change the ImagePath entry to:

1 “C:/memcached/memcached.exe” -d runservice -m 512

This way you will use 512 Mb memory limit for your server.

Google Client auth Login with PHP and Curl

// Construct an HTTP POST request
$clientlogin_url = "";
$clientlogin_post = array(
    "accountType" => "HOSTED_OR_GOOGLE",
    "Email" => "[email protected]",
    "Passwd" => "yourgooglepassword",
    "service" => "writely",
    "source" => "your application name"

// Initialize the curl object
$curl = curl_init($clientlogin_url);

// Set some options (some for SHTTP)
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $clientlogin_post);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

// Execute
$response = curl_exec($curl);

// Get the Auth string and save it
preg_match("/Auth=([a-z0-9_\-]+)/i", $response, $matches);
$auth = $matches[1];

echo "The auth string is: " . $auth;
// Include the Auth string in the headers
// Together with the API version being used
$headers = array(
    "Authorization: GoogleLogin auth=" . $auth,
    "GData-Version: 3.0",

// Make the request
curl_setopt($curl, CURLOPT_URL, "{Google service feed link}");
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_POST, false);

$response = curl_exec($curl);

// Parse the response
$response = simplexml_load_string($response);

echo "<pre>";
echo "</pre>";