note 32804 deleted from function.include by sniper
| From: | sniper@php.net | Date: | Tue, 04 Nov 2003 00:42:25 +0000 |
| Subject: | note 32804 deleted from function.include by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-59792@lists.php.net to get a copy of this message | ||
Note Submitter: lordwo_NOSPAM_@laposte_NOBOTS_.net
----
Let's define some terms:
/index.php
========
require("somewhere/included.php");
/somewhere/included.php
=========
require("second.php");
/second.php
=========
echo "hello world !";
The problem is the following: on windows system, with PHP 4.3.0, if you call included.php from
somewhere different of "/", you will get a warning/error.
A solution was told before, but wasn't clear enough for me, so I'm trying to re-explain
this.
Put absolute-path is generally not a bad idea, so we will use what I call 'semi-absolute
path' using the __FILE__ constant.
For each of your include(), do as following:
include(dirname(__FILE__) ."\\..\bla\bla");
This is supposed to be equivalent to ".\..\bla\bla", but in fact it's NOT.
The solution to our problem, is to put
require(dirname(__FILE__) . "\..\second.php");
to avoid any problem when calling the script.
Hope this helps