PDA

View Full Version : Warning: session_start() [function.session-start]: Node no longer exists in...


CraigR
04-27-2011, 12:14 AM
I recently moved hosting provider, and have come across an error which I hadn't previously noticed. (the error doesn't occur on my local server, only my hosting server)


Warning: session_start() [function.session-start (http://www.photostudio.forthwebsolutions.com/function.session-start)]: Node no longer exists in /xxx/galleryoptions.php on line 3


Line 3 on this page is as follows...


if (!session_id()) session_start();


If I comment out line 3, the error disappears

Dave Buchholz
04-27-2011, 01:32 AM
Do either of these links help

http://bytes.com/topic/php/answers/831550-session_start-node-no-longer-exists

http://www.phpbuilder.com/board/archive/index.php/t-10288395.html

are you using PHP5 code on a PHP4 server ?

CraigR
04-27-2011, 02:05 AM
Hi Dave, thanks for the feedback.

My hosting server is using php 5.2.12.

I can get rid of the message by commenting out the session_start line, (also suggested in one of the links you provided), but would like to understand why.

Dave Buchholz
04-27-2011, 02:07 AM
What's on the first two lines ?

CraigR
04-27-2011, 02:10 AM
Here is the php block before the doctype...

<?php require_once('Connections/photostudio.php'); ?>
<?php
//if (!session_id()) session_start();
if(!isset($_SESSION["gallery"])) {
$_SESSION["gallery"] = "grid_fullsize";//default value
}
if((((isset($_POST["gallerytype"]))?$_POST["gallerytype"]:"") != "")) {
$_SESSION["gallery"] = "".((isset($_POST["gallerytype"]))?$_POST["gallerytype"]:"") ."";
}
$gallery =($_SESSION['gallery']);
?>

Dave Buchholz
04-27-2011, 02:17 AM
this is the code I use to initialise sessions


/*
Enable Sessions
----------------------------------------------------------
*/

if (!isset($_SESSION)) {
session_start();
}


note the extra braces, try that and see if he makes a difference.

I have never seen this error and as you have no doubt found Google is not much help

CraigR
04-27-2011, 02:27 AM
thanks Dave , but no luck yet

I also checked the php.ini on my hosting server to see if session.auto_start was set, but it isn't.

Dave Buchholz
04-27-2011, 02:38 AM
sorry, don't know what else to suggest

hopefully Jason will have a bright idea

CraigR
04-27-2011, 02:47 AM
he usually does !

just noticed, when the page loads for the first time, all is ok.

use the form in the header to change the look, the page reloads.

on the second reload, the error occurs.

http://www.photostudio.forthwebsolutions.com/galleryoptions.php

Jason Byrnes
04-27-2011, 06:30 AM
I dont have any bright ideas on the cause of the problem, sorry guys.

to make the error go away, and still start the session, change:

if (!session_id()) session_start();


to:

@session_start();


This will run the session_start() function and suppress any errors that may occur.

CraigR
04-27-2011, 06:39 AM
Thanks Jason.

That at least hides the problem.

niviit31430686
09-26-2011, 10:37 PM
thanks buddy
i had a similar problem. n was resolved by using @session_start();