|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33475 CURLOPT_COOKIEJAR dosen't work in php5
Submitted: 2005-06-25 22:21 UTC Modified: 2005-06-26 19:31 UTC
From: edman007x at mac dot com Assigned:
Status: Closed Package: cURL related
PHP Version: 5.1b2 OS: Linux
Private report: No CVE-ID: None
 [2005-06-25 22:21 UTC] edman007x at mac dot com
in my php 5.0.3 and php 5.0.4 servers curl did not write 
to the cookieJar file even though it is writable and 
there are cookies that were received

phpinfo for working server is @ http://

phpinfo for php server that doesn't work is @ http://

Reproduce code:
header('Content-type: text/plain');
$file = tempnam('/tmp', 'php_bug_test');//should be writable
//a check
echo is_writable($file)?'This File Is Writable':'This File Is not Writable';
echo "\n";
//and again
echo system('ls -lah '.$file);
echo "\n";
$ch = curl_init('');///this site will give me a cookie
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, $file);
echo file_get_contents($file);

Expected result:
(i got this from a php 4.3.11 server)

This File Is Writable
-rw-------    1 nobody   nobody          0 Jun 25 15:15 
-rw-------    1 nobody   nobody          0 Jun 25 15:15 
# Netscape HTTP Cookie File
# This file was generated by libcurl! Edit at your own 
risk.	TRUE	/	FALSE	1149188400	FPB

Actual result:
(i got this from my php 5.0.4 server)

This File Is Writable
-rw-------  1 nobody nobody 0 2005-06-25 16:15 /tmp/
-rw-------  1 nobody nobody 0 2005-06-25 16:15 /tmp/


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-26 01:49 UTC] edman007x at mac dot com
i upgraded the server to 5.1b2 and it still didn't work
 [2005-06-26 13:32 UTC]
Add 'unset($ch);' after the 'curl_close($ch);' call and it will work. 
 [2005-06-26 19:31 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 18:01:25 2019 UTC