IIS wincache failing

874 Views Asked by At

This is driving us all nuts.

We have an IIS web server running php using wincache.

In iis we have the document root and a second part of the website mapped using a virtual directory.

First, here is the error:

PHP Fatal error:  session_start(): Failed to initialize storage module: wincache (path: C:\Windows\Temp)

We got the error to duplicate in a simple 1 line php file:

<?php
session_start();
?>

Here's the kicker

This file throws NO errors if placed anywhere in the root doc folder. BUT once placed in the virtual directory it will work for about 5 min then fail. It will continue to fail until we restart IIS.

We also have 2 servers identically configured. It's working with no issues on of the 2 servers.

2

There are 2 best solutions below

0
On

It sounds like the IIS application pool ID under which PHP is running does not have permissions to write to C:\Windows\Temp. You should check the ACLs on the folder to see if it is writeable by your app pool identity.

c:\Windows>icacls Temp
Temp NT AUTHORITY\SYSTEM:(OI)(CI)(S,RD)
     BUILTIN\IIS_IUSRS:(OI)(CI)(S,RD)
     BUILTIN\Users:(CI)(S,WD,AD,X)
     BUILTIN\Administrators:(F)
     BUILTIN\Administrators:(OI)(CI)(IO)(F)
     NT AUTHORITY\SYSTEM:(F)
     NT AUTHORITY\SYSTEM:(OI)(CI)(IO)(F)
     CREATOR OWNER:(OI)(CI)(IO)(F)

If you don't see BUILTIN\IIS_IUSRS on the ACL, then the default app pool ID can't write to that directory. If you're using a custom user ID for the app pool, you'll need to make sure it's on the ACL for the folder.

0
On

Not exactly the answer I was looking for. But we just spend a couple hours switching to Apache. Bug is gone, server is faster, all is good.