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

I'm not sure this is really a PERL question; but I'm hoping that someone else has encountered the same problem and knows the answer. I'm running Apache 2.0.43, PERL 5.6.1 on a Win XP machine doing a local intranet. Everything is running through the local's cgi-bin. Everything was running fine under Win98 SE. Bought a new comp with XP and oops, what is going on here? Bill G. has done it to me again...

As you can tell, I am trying to read a directory on a networked machine. The mystery is that..

  1. It worked on 98
  2. It works correctly in a command prompt window on the XP machine
  3. It doesn't work in the browser (IE6).
print "Content-type:text/html \n\n"; opendir(TRILL, '//Trillian/D/digis/weddings') or die "$!"; @trill= readdir(TRILL); closedir(TRILL); rest of code is HTML output
Monks, I await your redeeming chant.

Replies are listed 'Best First'.
Re: XP and Network opendir()
by NetWallah (Canon) on May 06, 2004 at 00:11 UTC
    Most likely, this is a security issue - you need to figure out what user ID the web page is running under, and if that User ID has sufficient rights.

    Posting the error message you got would help ....

    Offense, like beauty, is in the eye of the beholder, and a fantasy.
    By guaranteeing freedom of expression, the First Amendment also guarntees offense.
Re: XP and Network opendir()
by allyc (Scribe) on May 06, 2004 at 09:58 UTC

    I think i have had this problem in the past.

    The difference is that Apache in Windows 98 had to be run in a Terminal because Windows 98 didn’t support services. Because of this it would inherit the logon credentials of the person that was running apache.

    In Windows XP, Apache tends to run as a service with a local account that has no network privileges for security reasons.

    The way to resolve this is to create a new user account on the domain for the Web Server to use and grant that account permissions only to the resources that it needs and then set up the service to run as that account.

    In XP this can be done in Control Panel > Administrative Tools > Services. Select the Apache service and enter the details of the new account in the Logon tab.

    Then just restart apache and you should have access to the network.

    Because it is an intranet there are few security problems, however don’t run apache as a to privileged user account just in case.

    Hope this helps

    Alistair

Re: XP and Network opendir()
by Popcorn Dave (Abbot) on May 06, 2004 at 05:52 UTC
    This may or may not solve your problem but I've had problems with network shares when XP's built in firewall is turned on. If you're running some other type of firewall, you might try turning off XP's and see if that helps.

    Good luck!

    There is no emoticon for what I'm feeling now.