Por que o php curl não salva cookies no meu cookiefile?

Estou tentando salvar um cookie no cookiejar curl. Eu simplifiquei meu código, mas não está funcionando.

<?php

$cookie_file = './cookies.txt';

if (! file_exists($cookie_file) || ! is_writable($cookie_file)){
    echo 'Cookie file missing or not writable.';
    exit;
}//cookie_file is writable, so this is not the issue

$ch = curl_init (html_entity_decode("http://localhost/kiala_test/setcookie.php"));
curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie_file);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 1);
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$output = curl_exec ($ch);
echo $output;
?> 

setcookie.php

<?php 
$value = 'something from somewhere';
setcookie("TestCookie", $value);

?>

cabeçalho recebido

HTTP / 1.1 200 OK Data: Quinta, 10 de outubro de 2013 12:10:37 GMT Servidor: Apache / 2.4.4 (Win64) PHP / 5.4.12 X-Powered-Por: PHP / 5.4.12 Set-Cookie: TestCookie = algo + de + em algum lugar Content-Length: 0 Content-Type: text / html

então o testcookie está no cabeçalho, mas meu cookiefile fica vazio. O que estou fazendo errado? O que posso tentar fazer com que este exemplo funcione? obrigado!

questionAnswers(3)

yourAnswerToTheQuestion