Php – IIS 7 / PHP 5.3.6 Permission denied when accessing network file

iisPHP

ServerA-> 64 Bit Windows 2008 (IIS 7 && PHP 5.3.6)

ServerB-> 32 Bit Windows 2003 (Fileserver)

I'm trying to access a \ServerB\directory1\directory2\file.abc via fopen through a site hosted on ServerA and am getting a Permission Denied error. It's the default website using the default application pool.

What I've tried giving the following accounts or groups in the AD full permissions to the directory (and file through inheritance) and it still gave the error:

  • manually created a IUSR_SERVERA account (it didn't previously exist)
  • IIS_WPG
  • Everyone
  • Network Service
  • Anonymous Access
  • Authenticated Users

The Identity for the DefaultAppPool is NetworkService and has 32 bit applications enabled.

IUSR_SERVERA has full permissions to the local php directory.

Any help is appreciated. I've temporarily solved the issue by copying the file needed locally to SERVERA's wwwroot folder, but that can't be a permanent solution at all.

Thanks

-Mike

Best Answer

Thanks for the ProcMon suggestion, it brought me to the answer. I didn't set up the default application correctly.

I read and re-read everything I could find, but nothing said this specificially:

If you need to access network files using PHP through IIS 7, set up an account with proper credentials in the Application Defaults for the site you're working on.

To do so, go into the IIS Manager

  1. Select your site from the Connections pane
  2. Click the View Applications link in the Actions pane (far right side of the screen)
  3. Click Set Application Defaults in the Actions pane in the new screen
  4. Choose DefaultAppPool from the Application Pool section
  5. Enter proper credentials in the Physical Path credentials section

Know that changing the Process Model -> Identity in the Advanced Settings of the Default App Pool had no effect on allowing it to happen.