note 62314 added to function.require
| From: | steve at walkerfx dot com | Date: | Fri, 24 Feb 2006 23:24:02 +0000 |
| Subject: | note 62314 added to function.require | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-104386@lists.php.net to get a copy of this message | ||
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
----
Server IP: 216.194.113.175
Probable Submitter: 24.205.47.225
----
Manual Page -- http://www.php.net/manual/en/function.require.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+62314
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+62314&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+62314&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+62314&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+62314&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+62314&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+62314&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+62314&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+62314&report=yes
Search -- http://master.php.net/manage/user-notes.php