
yapp
User
Oct 5, 2001, 2:59 AM
Post #1 of 1
(2474 views)
|
|
Solution to IIS error (relative (require) paths)
|
Can't Post
|
|
OK, I've posted this code in some other topics aswell. I think it's very important everyone knows about this. Most complex scripts fail running under IIS with relative paths or require 'file' files. Most of the time, a 'can't locate at @INC', or 'file not found' message appears. This is because the current directory in IIS is the WWW-root. I've seen a solution to this problem in the code of a different BB system. Here it is:
BEGIN { $THIS_PATH = 'current-directory'; if($ENV{'SERVER_SOFTWARE'} =~ /IIS/) { push @INC, $THIS_PATH; chdir($THIS_PATH); } } ... # This all works now!!! require 'morecode.pl'; open('file.txt') or die .... Hope it helps... (well, it worked for me)
|