Ok, I have seen a lot of gripes about the php include() directive here. It seems this is become a cause of grief for me too.
My site structure is something like this:
public_html\index.php
public_html\includes\content.inc.php
public_html\language\en\language.inc.php
public_html\classes\db.inc.php
The site runs swell on Apache no issues. It does not work on IIS however (grr... #@!!!%).
Let me explain: What is done is that index.php is always called by the webbrowser and depending on the request, it includes content.inc.php (there are many of these content files and index.php includes the appropriate one based on logic)
// -- index.php --
include(includes/content.inc.php);
So far it works well on both Apache and IIS.
Now content.inc.php in turn includes lang.inc.php and db.inc.php.
It looks like:
// -- content.inc.php --
include(language/en/language.inc.php)
include(classes/db.inc.php)
These lines work well on Apache but IIS complains it cant file the files to be included.
Why? Because Apache maintains the current folder "." is public_html\
where the script execution first started.
IIS on the other hand changes the meaning of "." to be the file that is currently being processed. i.e after including content.inc.php, IIS interprets "." as being public_html\includes\
Now I know one solution is to change all include paths to be absolute in some way. But my question is, is this really an Apache/IIS issue as I understand it? Is there an IIS or PHP setting to make it behave correctly without mucking about in the code?
BTW, PHP.ini has the
include_path=".;C:\PHP\PEAR"