Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 11-25-2003, 07:28 PM   #1 (permalink)
a_o
Registered User
 
Join Date: Nov 2003
Posts: 5
a_o is on a distinguished road
php sessions

i seem to be having some trouble getting php sessions to work with my new slackware 9.1 install. basically php and everything is working fine and i set session.auto_start to 1 in php.ini......is there anything that i am forgetting?
thanks,
a_o is offline   Reply With Quote
Old 11-25-2003, 08:44 PM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,486
sde is on a distinguished road
i've never tried the auto_start feature, but can you get sessions to start with the normal call in the code?
__________________
Mike
sde is offline   Reply With Quote
Old 11-26-2003, 12:40 AM   #3 (permalink)
a_o
Registered User
 
Join Date: Nov 2003
Posts: 5
a_o is on a distinguished road
i know the code works i just carried it over from my old slackware 8.1 box to slackware 9.1. im using session_start(); and session_destroy(); but the problem is that the sessions arent registering. i think its a problem with the php.ini config file, but i looked over it and cant seem to find anything wrong with it. thanks
a_o is offline   Reply With Quote
Old 11-26-2003, 01:01 AM   #4 (permalink)
a_o
Registered User
 
Join Date: Nov 2003
Posts: 5
a_o is on a distinguished road
i think the problem is when i run the script in console, ie #php auth.php it says the cookie expires thu, 19 nov 1981......any idea where this date comes from or how to change it? my system time is fine and everytihing,, it doesnt make sense.
thanks
a_o is offline   Reply With Quote
Old 11-26-2003, 06:58 PM   #5 (permalink)
a_o
Registered User
 
Join Date: Nov 2003
Posts: 5
a_o is on a distinguished road
ok after messing around with it all for a while i got an error:


Warning: Cannot modify header information - headers already sent by (output started at /var/www/connect.php:18) in /var/www/login.php on line 37

Warning: Unknown(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0

so i guess when i went from PHP 4.2.0 to 4.3.3 there were some compatibility issues with my code.
a_o is offline   Reply With Quote
Old 11-26-2003, 11:55 PM   #6 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,486
sde is on a distinguished road
make sure you have NO whitespace before you start your session. session functions need to happen in the header BEFORE anything is printed to the browser.

that is what is causing that error:

for example.. this is wrong
PHP Code:

<?
session_start
();

// notice the white space above the <? tag
// this is bad mmkay?
?>
this is right
PHP Code:
<?
session_start
();
// no white space or echo'ing to the browser before session is called
?>
__________________
Mike
sde is offline   Reply With Quote
Old 11-27-2003, 02:05 AM   #7 (permalink)
a_o
Registered User
 
Join Date: Nov 2003
Posts: 5
a_o is on a distinguished road
well i figured it out,....fyi since 4.2.3 php turned off register_globals by default....now that i am using php4.3.3 there is a compatibility issue. so i just turned it back on, even though it is insecure

thanks sde
a_o is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Comes of Age sde Code Newbie News 0 04-14-2004 11:41 AM
new to php jhoop2002 PHP 12 08-06-2003 02:45 PM
I need to learn PHP Nitro PHP 9 06-28-2003 11:24 AM
Php Vs. Asp sde PHP 6 06-06-2003 06:02 PM
PHP as CGI?? bdl PHP 8 05-08-2003 08:29 AM


All times are GMT -8. The time now is 04:42 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting