note 28215 deleted from configuration.directives by sniper

From: Date: Tue, 04 Nov 2003 00:46:40 +0000
Subject: note 28215 deleted from configuration.directives by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-59836@lists.php.net to get a copy of this message
Note Submitter: Stan Insyder ---- It appears that a *nix machine and a Win machine handle includes a bit differently. (This applies for require() also). Here's an example to explain the problem... I have a file in the root dir /index.php which includes a file in /functions/ setting my includes to functions/file.php works fine, but if I include a file from inside file.php to say file2.php a *nix based machine looks for a file as if it were starting off in the root, while a win machine stays in the functions directory, where the last file was included. I've had this problem on two win server's and two linux servers, so I'm pretty sure it's not my config error. Anyway, this is my quick way of solving the problem. if (eregi("nix",$_SERVER['SERVER_SOFTWARE'])) { # Unix/Linux style include $includeDirPath = "functions/"; } else if (eregi("nix",$_SERVER['SERVER_SOFTWARE'])) { # Windows style include $includeDirPath = ""; } Obviously with every include I typed it out as such... include $includeDirPath . "file.php"; Hope that helps anyone experiencing the same problem as I was!

« previous php.notes (#59836) next »