Dovkont has asked for the wisdom of the Perl Monks concerning the following question:


Maybe it is not fully right place to post _this_ question, but, since it is still very related to Perl...

Thanks for the generous help of the monks, I have finally finished my Perl program (a number of scripts), and began testing it remotely. Now, on remote access, I have found a strange bug, that a file, that should be opened by a script to writing

open (IDFILE,"+>$idfile") || die "2. Unable to open $idfile $!\n";

in fact is not opening, despite the command does not produce an error message, and an attempt to print into the file brings to halt of the script execution. The file is in read/write/execute permission mode on IIS server on Windows XP. Is there any way to overcome this (in any case, due to the requirements, I should be able to write into several files)?

Thanks in advance,

Replies are listed 'Best First'.
Re: Files on MS IIS server
by SquireJames (Monk) on Dec 17, 2003 at 01:05 UTC
    How are you referencing the file to open? Are you using UNC paths, is it local to the script or are you trying to use HTML?

    More information would be great....

      The filename of the $idfile is determined by the program, and references to a file almost local to the script (one directory below). Anyway, it is relative local path.

      The file opens for reading without problems. The halt occurs on trying to open the file for writing. Using absolute paths does not make any effect.

        Have you checked the security permissions for this file? IIS will use the IUSR_<servername> account when your CGI script is run. Normally the IUSR_ account only has read access to files.

        Try setting the file security to Everyone / Full Control to see if that helps. You can change the security again later to remove the Everyone group and use the IUSR_ account explicitly.

Re: Files on MS IIS server
by barbie (Deacon) on Dec 17, 2003 at 12:15 UTC
    the command does not produce an error message

    Unfortunately IIS doesn't capture errors and save them in an error log like Apache, so this is one reason why you would be unaware of the error. The browser will not necessarily give you any further information unless you ask it to. One way of doing this is with:

    use CGI::Carp qw(fatalsToBrowser);

    Which will throw errors to the browser. Regards your specific file error, is the permission modes set for ALL users? You may also need to set the directory permissions too. If IIS is running as a guest user, they may not have permission to access the file. This is the same with any webserver and is part of the security measures to ensure protected files cannot be tampered with.

    Barbie | Birmingham Perl Mongers |