I have this problem.
The directory structure is
root/
root/includes/
In root/ there are several files that call the same include file eg. incOne.php
So we have index.php and search.php in root/ that both have this code fragment.
include('includes/incOne.php');
This works fine on both IIS and Apache.
However, incOne.php also has an include file db.php that is in root/includes/
Now to get this to work on Apache the code in incOne.php that is in root/includes is like this;
include('includes/db.php');
I think the logic goes that since incOne is included in index.php in root/ that it is considered part of that file and directory and therefore the path into includes is necessary.
IIS on the other hand insists on the code in incOne.php to be like this;
include('db.php');
If it isn't we get the failed opening error.
I think the logic here is that both includes are in the same directory and therefore no path is necessary, even though incOne was used in a root/ level parent file.
I think the IIS logic is functionally wrong and the Apache is better, but here is my question. How can we get the same code to work on both web server platforms, without having to amend the paths whenever we want to upload from development to production?
Do we have to use absolute paths all the time, (we would prefer not to)?
Is there a setting in IIS that will cause it to see directories in a similar way to Apache, (much preferred)?