note 28215 added to configuration.directives

From: Date: Mon, 06 Jan 2003 12:39:42 +0000
Subject: note 28215 added to configuration.directives
Groups: php.notes 
Request: Send a blank email to php-notes+get-41720@lists.php.net to get a copy of this message
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! -- http://www.php.net/manual/en/configuration.directives.php http://master.php.net/manage/user-notes.php?action=edit+28215 http://master.php.net/manage/user-notes.php?action=delete+28215 http://master.php.net/manage/user-notes.php?action=reject+28215

« previous php.notes (#41720) next »