Page 1 of 1

cURL interfering with Sessions ?

Posted: Tue Mar 28, 2006 1:34 am
by anjanesh
Hi

In one my sites, Im using cURL and sessions.
This exists in one script :

Code: Select all

curl_setopt ($handle, CURLOPT_COOKIESESSION, TRUE);
curl_setopt ($handle, CURLOPT_COOKIEFILE, "cookie.txt");
curl_setopt ($handle, CURLOPT_COOKIEJAR,  "cookie.txt");
And I have sessions in the my session script which is included in all pages anyway - so session_start() is started always.

Question - Does cURL in anyway affect session handling routines ?

Because now Im getting this which wasnt there before - I thought I had cleared all my session problems !

Code: Select all

Warning: session_module_name() [function.session-module-name]: A session is active. You cannot change the session module's ini settings at this time. in xxx.php
My session data are stored in a MySQL db and curl's cookie in C:\Program Files\Apache Group\Apache2

Thanks

Posted: Tue Mar 28, 2006 2:07 am
by feyd
It's not cURL. The following produces the error.

Code: Select all

<?php

session_start();
session_module_name('files');

?>
some stuff
While the following does not.

Code: Select all

<?php

session_module_name('files');
session_start();

?>
some stuff

Posted: Tue Mar 28, 2006 4:09 am
by anjanesh
Actually I have it like this :

Code: Select all

session_module_name("user");
session_start();
session_set_save_handler("Session_Open", "Session_Close", "Session_Read", "Session_Write", "Session_Remove", "Session_GC");

Posted: Tue Mar 28, 2006 9:11 am
by feyd
are you sure you don't have session_start() somewhere else? What about session.auto_start?

Posted: Tue Mar 28, 2006 12:14 pm
by anjanesh
Its actualy preset in one file which is included just once (include_once()).
I found out the reason why it gave those errors - if i dont logout and go back to the login page and enter the user/pass, it gives these errors.