note 84052 added to function.include

From: Date: Wed, 25 Jun 2008 17:34:33 +0000
Subject: note 84052 added to function.include
Groups: php.notes 
Request: Send a blank email to php-notes+get-140814@lists.php.net to get a copy of this message
When using includes with allow_url_include on in your ini beware that, when accessing sessions from included files, if from a script you include one file using an absolute file reference and then include a second file from on your local server using a url file reference that they have different variable scope and the same session will not be seen from both included files. The original session won't be seen from the url included file. So: main script: <?php session_start(); $_SESSION['count'] = 234; echo "sid from script1".session_id(); include "/var/www/htdocs/file1"; include "http://yoursite/file2"; ?> file1 <?php echo " **sid from file1: ".session_id(); echo " count from file1= ".$_SESSION['count']; ?> echoes both a session id and the count but file2 <?php echo " **sid from file2: ".session_id(); echo " count from file2= ".$_SESSION['count']; ?> echoes just the text, no session id and no count. ---- Server IP: 69.147.83.197 Probable Submitter: 132.239.12.245 ---- Manual Page -- http://www.php.net/manual/en/function.include.php Edit -- https://master.php.net/note/edit/84052 Del: integrated -- https://master.php.net/note/delete/84052/integrated Del: useless -- https://master.php.net/note/delete/84052/useless Del: bad code -- https://master.php.net/note/delete/84052/bad+code Del: spam -- https://master.php.net/note/delete/84052/spam Del: non-english -- https://master.php.net/note/delete/84052/non-english Del: in docs -- https://master.php.net/note/delete/84052/in+docs Del: other reasons-- https://master.php.net/note/delete/84052 Reject -- https://master.php.net/note/reject/84052 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#140814) next »