|
Posted by Rik on 07/28/07 21:40
On Sat, 28 Jul 2007 22:43:37 +0200, Ray <rod@iol.ie> wrote:
> On Jul 28, 7:39 pm, Rik <luiheidsgoe...@hotmail.com> wrote:
>> Is the full path in get_included_files() or isn't it? And are you =
>> calling
>> it by the full path or not? Perhapse it's an include_path issue. Then=
>> again, it might be as simple as a relative call in on of the =
>> applications
>> which doesn't turn out OK, because it makes wrong assumptions about t=
he
>> current working directory, in which case they should be fixed.
>
> Rik, thanks for your reply.
>
> Yes, the full path is returned by get_included_files(). When I call a
> page from one of the apps - call it App_1 - (before I access the other=
> app) get_included_files() returns the following, which is what I
> expect:
>
> C:\Documents and Settings\rod\Documents\JBrick\DayStudents\php_scripts=
> \authenticate.php
> C:\Documents and Settings\rod\Documents\JBrick\DayStudents\php_scripts=
> \config.php
>
> As you can see, the config.php called is the one in the same directory=
> as the calling script. However, if I then access the other app (call
> it App_2) from a different browser window, then go back and refresh
> the first page, it has changed to this:
>
> C:\Documents and Settings\rod\Documents\JBrick\DayStudents\php_scripts=
> \authenticate.php
> C:\Documents and Settings\rod\Documents\JBrick\MusicSchool
> \musicadmin.www\trunk\config.php
>
> The wrong config.php is now being called. What worries me is that I
> had assumed the two apps would be isolated from each other, but
> apparently they're not. I can't figure why anything I did in one app
> would have a bearing on another.
>
> In case it's any help, here is a fragment from the top of a script
> from App_1:
>
> <?php
> require 'config.php';
>
> $files =3D get_included_files();
> foreach ($files as $f) {
> print "$f<br />\n";
> }
> //.... [snip]
> ?>
>
> And likewise from App_2:
>
> <?php
> require_once 'config.php';
> // .... [snip]
> ?>
Both apps asume they know where they are running, which is bad, very bad=
.. =
No fault/bug in PHP, just careless coding.
Usually I solve this problems bij require(dirname(__FILE__).'/config.php=
');
-- =
Rik Wasmus
Navigation:
[Reply to this message]
|