Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8995367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:36:38+00:00 2026-06-15T23:36:38+00:00

I’m trying to connect to a network share (by it’s UNC) from the browser,

  • 0

I’m trying to connect to a network share (by it’s UNC) from the browser, but am unable to.

If I run my script from the command line, everything is fine and I can access the share. I’m also able to navigate to it through Windows’ file explorer, so I don’t think there’s anything wrong with my code, or the permissions for my Windows account.

My script looks like this:

$dir = '\\\\some\path';

if (is_dir($dir))
{
    echo 'dir exists';
} 
else
{
    echo 'dir does not exist';
}

I also tried using DirectoryIterator($dir), but that throws this exception error:
PHP Warning: opendir(...): Access is denied. (code: 5)

Here’s my setup:
– Windows Server 2008 R2
– IIS 7.5
– PHP 5.3.13
– Anonymous Authentication disabled
– Windows Authentication enabled

And I have these config settings in my php.ini:

cgi.force_redirect=0
cgi.fix_pathinfo=1
fastcgi.impersonate=1

To add to the confusion, I was able to connect through the browser under these scenarios:

1 – using system("net use \"".$dir."\" ".$pass." /user:".$user." /persistent:no>nul 2>&1"); But this requires hardcoding the user’s Windows auth password, which I can’t do.

2 – Setting fastcgi.impersonate=0 But this means the user would have to authenticate everytime they hit the script, which is unacceptable.

3 – Enabling Anonymous Authentication, disabling Windows Authentication, but I need Windows Auth enabled in order to know who’s accessing the site.

I don’t know if this has anything to do with my problem, but I get different values for $_SERVER['USERNAME'] when running my script from the browser and from command line.

Is this a permissions issue? Is there an authentication token that’s not being passed along?

Edit
Mapping the share to a network drive isn’t an option in this case, unfortunately.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:36:39+00:00Added an answer on June 15, 2026 at 11:36 pm

    It should work but you need the user who runs the php process to have access to the path.

    In your case, if not in a domain, you can try to create a user on your server and set it as the application pool owner. Then you create the same user/password on the other computer and give access to the shared folder.

    Looks ugly I agree but should work.

    EDIT

    Or yes, as suggested by Neal, create a mapped folder. May be easier.

    EDIT 2

    Assuming you are not in a domain, to create the user and assign it to run the application do as following:

    1. Create the user
      Create the user

    2. Run iismanager and set the user to run the application

    Assign the user to run your application

    The last step is to create the same exact user (password as well) on the remote server where you are sharing the path and add this user in the security tab with the rights you need.

    You may need to restart iis: iisreset

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a small JavaScript validation script that validates inputs based on Regex. I
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.