views:

16

answers:

1

I'm dealing with an outdated PHP4 IIS server which has odd settings and I absolutely cannot update PHP or modify any server settings.

This legacy site on the server basically has subdirectories which have an includes directory so there are multiple includes directories, and in my root I do something like

include 'includes/nav.php';

There are around 10 nav.php files in includes directories throughout, so sometimes the wrong one gets pulled in.

I found a workaround by just prefixing the absolute local filesystem path to it, eg

$base = dirname(__FILE__);
include $base . '/includes/nav.php';

However, in order to apply the fix I'd have to alter pretty much every file.

Every file includes the same configuration file though. Is there some ini function trick I could use so that each subdirectory grabs its respective include file from its relative directory path instead of other includes directories?

+2  A: 

If I am understanding your issue correctly, it looks like changing the include_path (either in a php.ini, or by using ini_set('include_path', '...') or set_include_path('...')) so that the relative include folder is tried first, or before any of the other include folders, might help.

salathe