By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,944 Members | 1,449 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,944 IT Pros & Developers. It's quick & easy.

Required files confused between applications on same server

P: n/a
Ray
Hi all,

I'm running PHP 5.2.0 on my Windows XP laptop, running under IIS. I
have files named 'config.php' in two different web applications on
this machine, which are included throughout each via 'require' in one
and 'require_once' in the other.

When I attempt to use the two applications simultaneously, the file
which was 'require_once'-ed is also being accessed from the other
application, even though the two applications are isolated from each
other in IIS, and are in completely different directories on the
computer.

Has anyone come across this before? Is it a known bug?

Thanks,

Ray.

Jul 28 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Rik
On Sat, 28 Jul 2007 20:32:47 +0200, Ray <ro*@iol.iewrote:
Hi all,

I'm running PHP 5.2.0 on my Windows XP laptop, running under IIS. I
have files named 'config.php' in two different web applications on
this machine, which are included throughout each via 'require' in one
and 'require_once' in the other.

When I attempt to use the two applications simultaneously, the file
which was 'require_once'-ed is also being accessed from the other
application, even though the two applications are isolated from each
other in IIS, and are in completely different directories on the
computer.

Has anyone come across this before? Is it a known bug?
Normallly, PHP checks a full path afaik, but I have no experience with IIS

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 the
current working directory, in which case they should be fixed.
--
Rik Wasmus
Jul 28 '07 #2

P: n/a
Ray
On Jul 29, 5:14 pm, Rik <luiheidsgoe...@hotmail.comwrote:
On both. PHP has a 'current working dir', the files are searched in the
include_path, wich usually holds '.' (the current working directory), and
possibly others. This current working dir is not the directory of the file
that asks for an include/require, but usually where the process started.
It can be quite confusing when including several files, so to check what
the dir is you can use get_cwd();
OK, I'm starting to understand. I've experimented a bit, and when I
access the first app, getcwd() returns c:\windows\system32. However, I
then access the other app, and then when I go back to the first, the
working directory has changed to the root of the second app!

I don't yet understand why the second changes the working directory,
while the first doesn't....the only difference between them is that
the first uses require() while the second uses require_once().

Ray.

Jul 29 '07 #3

P: n/a
Rik
On Sun, 29 Jul 2007 18:48:58 +0200, Ray <ro*@iol.iewrote:
On Jul 29, 5:14 pm, Rik <luiheidsgoe...@hotmail.comwrote:
>On both. PHP has a 'current working dir', the files are searched in the
include_path, wich usually holds '.' (the current working directory),
and
possibly others. This current working dir is not the directory of the
file
that asks for an include/require, but usually where the process started.
It can be quite confusing when including several files, so to check what
the dir is you can use get_cwd();

OK, I'm starting to understand. I've experimented a bit, and when I
access the first app, getcwd() returns c:\windows\system32. However, I
then access the other app, and then when I go back to the first, the
working directory has changed to the root of the second app!

I don't yet understand why the second changes the working directory,
while the first doesn't....the only difference between them is that
the first uses require() while the second uses require_once().
Impossible to tell without the code (and I must confess I try to stay
clear of IIS), but a simple chdir() will offcourse change the working dir.

--
Rik Wasmus
Jul 29 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.