cURL interfering with Sessions ?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

cURL interfering with Sessions ?

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post 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");
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

are you sure you don't have session_start() somewhere else? What about session.auto_start?
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post 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.
Post Reply