note 62314 deleted from function.require by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 14:55:41 +0000 |
| Subject: | note 62314 deleted from function.require by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-197245@lists.php.net to get a copy of this message | ||
Note Submitter: steve at walkerfx dot com
----
WARNING: Be absolutely sure that your include paths are relative or directory based and not http!!!
require("http://www.mydomain.com/somefile.php");
//WRONG!!
require("usr/mydomain/somefile.php"); //CORRECT!!
If you are intending to access local files and you accidentally use an http address, the request
will probably work. However, this creates a wierd situation that can cause all sorts of bugs in your
scripts and slow your code down.
The problem is that the include spawns off another php request, and is essentially requesting the
file in the same a way a remote viewer would. So rather than including the intended php code,
instead you get the processed output from that single file executed in its own private scope.
It's a simple mistake, but it can be an awful problem to debug.
Walker