note 84052 deleted from function.include by googleguy

From: Date: Tue, 22 Oct 2013 11:01:44 +0000
Subject: note 84052 deleted from function.include by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-197032@lists.php.net to get a copy of this message
Note Submitter: huuanito ---- 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.

« previous php.notes (#197032) next »