session start

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

FireElement
Forum Commoner
Posts: 86
Joined: Wed Oct 17, 2007 6:03 pm

Post by FireElement »

feyd wrote:Then I guess you are stuck.

By the way, please don't attempt to bypass the swear filter again.
sorry!! I just really dont get it! Its stressing me out, as I need it so I can run a captcha. To stop spam and I just dont get it....
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Is there an auto_prepend file set? It's a setting in the ini file.
FireElement
Forum Commoner
Posts: 86
Joined: Wed Oct 17, 2007 6:03 pm

:( :(

Post by FireElement »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


[quote="feyd"]Is there an auto_prepend file set? It's a setting in the ini file.[/quote]

I dont know? where is it located? 

I just put the following folder in on its own... 

in my index.php

Code: Select all

<?php

function session_started(){
    if(isset($_SESSION)){ return true; }else{ return false; }
}

//Start the output buffer so we dont create any errors with headers
ob_start();

//Check to see if it has been started
if(session_started()){
    echo 'The session has been started.<br />';
}else{
    echo 'The session has not been started.<br />';
}

//Start the session
echo 'Starting Session...<br />';
session_start();

//Check again
if(session_started()){
    echo 'The session has been started.<br />';
}else{
    echo 'The session has not been started.<br />';
}

//Flush the buffer to screen
ob_end_flush();

?>
This is what happens

The session has not been started.
Starting Session...

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /data01/mlouret/public_html/share-tips/index.php:2) in /data01/mlouret/public_html/share-tips/index.php on line 20

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /data01/mlouret/public_html/share-tips/index.php:2) in /data01/mlouret/public_html/share-tips/index.php on line 20
The session has been started.


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

That is to be expected, you echo before session_start() is called.
FireElement
Forum Commoner
Posts: 86
Joined: Wed Oct 17, 2007 6:03 pm

Post by FireElement »

Yeah but I just put

Code: Select all

<?php session_start(); ?>
in a file nothing before after and it did the same thing I dont know whats going on...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

FireElement wrote:Yeah but I just put

Code: Select all

<?php session_start(); ?>
in a file nothing before after and it did the same thing I dont know whats going on...
You've said this many times already. I understand it. That's why I asked about auto_prepend. You can often find where your ini file is by looking at phpinfo().
FireElement
Forum Commoner
Posts: 86
Joined: Wed Oct 17, 2007 6:03 pm

Post by FireElement »

hey thanks for helping me... I did phpinfo() it brough loads up. what should I be looking for?
User avatar
Stryks
Forum Regular
Posts: 746
Joined: Wed Jan 14, 2004 5:06 pm

Post by Stryks »

Scroll down to Configuration / PHP Core and look for the setting auto_prepend_file.

By default, this should read 'no value'.
FireElement
Forum Commoner
Posts: 86
Joined: Wed Oct 17, 2007 6:03 pm

Post by FireElement »

Stryks wrote:Scroll down to Configuration / PHP Core and look for the setting auto_prepend_file.

By default, this should read 'no value'.
yeah it does...
Post Reply