|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-06-26 14:17 UTC] code at 4arrow dot com
A PHP file that includes a local file via a HTTP header request usign the full and absolute local URL (http and domain) is seen as a local call from with the server and treated as a separate session and PHP parser run from the existing PHP run that the include is beign requested within. This changes the $_SERVER['REMOTE_ADDR'] variant to the $_SERVER['SERVER_ADDR'] variant which is technically accurate but practically useless. Also all exisitng sessions or cookies are no longer available to the included local file because calling it via a absolute URI caused a http header request which I suppose creates a new session and extraneous server load. How about viewing absolute URIs in their context, if they are on the same domain/server to bear that in mind for the benefit of the developer? Now, I understand the need for a unique header request to reset new env variables but at the same time options are a good thing. How about both? A full URI can call both a local php file that retains the variables scope of its parent as well as one that doesn't or even better yet a new unique version prefix is added to the new HTTP header request and its created env variables and it is not viewed in isolation but as a part of an existing process. The request feature is to be able to call a absolute URL http://4arrow.com/test/test/php within an existing PHP script both on the same domain name and server name that has access to all the preset variables above it as well as unique variables within as a new unique HTTP request, lastly after it all variables from before it are also still available. Basically to retain the variable scope across absolute HTTP requests within local scripts that call local uris. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 08 00:00:01 2025 UTC |
This made absolutely no sense to me. If someone else can make sense of this, feel free to unbogus it. What in the world do you mean by, "A PHP file that includes a local file via a HTTP header request" ? As in header('Location: http://local.domain/file.php') ? That is a client-side redirect which means the remote browser is going to make a completely separate request which may or may not come back to the same process or even the same physical server in a load-balanced architecture. Expecting any sort of variable persistency across client-side redirects is rather silly. This is what sessions are for.Oh, I understand what you are asking for, it just still makes absolutely no sense to me. Why would you incur the overhead of an unneccesary HTTP request just for code flow? Wrap your include function yourself then. function my_include($url) { $a = parse_url($url); if($a['host'] == $_SERVER['SERVER_NAME'] { $file = $_SERVER['DOCUMENT_ROOT'].$a['path']; } else $file = $url; include $file; } my_include('http://localdomain/file.php'); That's all. Building this into PHP doesn't make any sense to me.