php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28465 Session variables not being kept with include_once()
Submitted: 2004-05-21 03:43 UTC Modified: 2004-05-21 05:33 UTC
From: dave at faf dot co dot nz Assigned:
Status: Not a bug Package: Session related
PHP Version: 4.3.4 OS: linux
Private report: No CVE-ID: None
 [2004-05-21 03:43 UTC] dave at faf dot co dot nz
Description:
------------
When i use an include/require to load a success page ( in this case, the list the "add" was called from ) the session variables are not present. I have session_start() on each page, and if i call the pages directly ( from a menu ) the sessions remain. This happends every time i do this. I dont know if its a bug, but i have to control over the webserver as its a web hosting plan.

Reproduce code:
---------------
<?php
session_start();
if (isset($_POST['submit']) {
  //do saveing stuff
  $OK = true;
}
if ($OK) {
  //display form, submit button at bottom
  //page calls itself, or rather, blank action
}
else {
  require_once('list.php');
}

Expected result:
----------------
the original listing come back up, with the new addition.

Actual result:
--------------
the frame/table for the expected result, empty due to session vars not relaying the clientid or any other for that matter.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-05-21 03:49 UTC] dave at faf dot co dot nz
Okay. I've figured it out. nasty linux issues. ( sorry. hate linux for all the wrong reasons )

Please leave this here for others to find, i wouldn't have had the trouble otherwise.

The require_once/include_once functions, when running in linux, must be complete paths, not http's. my path to the included file worked properly again when i used :
"/home/faf/faf.co.nz/profilerpe/" infront of the page name. Apparently the page is run when you use an url, instead of being included.

Dave.
 [2004-05-21 05:33 UTC] magnus@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Sep 18 07:00:01 2025 UTC