PHP IIS Windows Server 2003 - Help needed.
January 27, 2010 3:19 AM   Subscribe

At my wits end with PHP5 on IIS6 Windows Server 2003. (Two days in - in desperate need of help and guidance)

I am new to php and am trying to setup it up on a Windows Server 2003 machine. I am doing so on IIS 6 as opposed to Apache as I have read that ISS and Apache sometimes conflict and I would like to avoid messing with any other sites on this machine. Firstly here is the error:

When I go to the following page
I am told You are not authorized to view this page. That is following 3 prompts to enter a username and password. (On a side note even after entering a valid username/password I am re-prompted a further 2 times)

Here is what I have done so far and some other information that maybe of use in determining the cause:

1 - This html page in the same location is fine.
2 - This asp page also in the same page is fine.
3 - I installed PHP following this simple youtube tutorial
4 - I used the ZIP package and not the installer and did everything according to the instructions but am still having the permissions issue.
5 - I have added IUSER_XXXXX and give them full control of the appropriate folder.
6 - I have added php as a Web Service Extension in IIS.
7 - In my ISS site configuration I have specified that .php files be handled by c:\php5\php5isapi.dll
8 - I have not made any changes to the contents of php.ini-recommended which I renamed to php.ini and moved to the windows dir, I have also copied php5ts.dll to windows system32

I have googled and googled and googled to no avail - they mainly suggest giving permission to IUSER_**** on the directory, which I have done, still no dice.

I am absolutely at my wits end with this and , I am a lone techie in my organisation - Can anyone here help me?

Thanks.
posted by therubettes to Computers & Internet (21 answers total) 1 user marked this as a favorite
 
Just a guess..Temporarily elevate"IUSER_XXXXX" admin if that works then you at least have a place to start trouble shooting. Remember not to leave IUser as admin.
posted by jmsta at 4:23 AM on January 27, 2010


Temporarily elevate"IUSER_XXXXX" admin if that works then you at least have a place to start trouble shooting. Remember not to leave IUser as admin

Thanks jmst - I just elevated it and tried the page again - no success - took IUSER out of the group again.

On preview tried pasting the contents of test.php but its not allowed. In any case it just the simple phpinfo(); with the php stuff wrapped around!


posted by therubettes at 4:31 AM on January 27, 2010


I remember back in the days I was using IIS and banging my head against a wall trying to get it to work with PHP, two big things were:
  1. Make sure your PHP directory is in the Windows PATH (Right-click My Computer -> Properties -> Advanced -> Environment Variables -> System variables -> "PATH"). Just add the PHP directory to the end of whatever's there (be sure to separate different paths with semicolons).
  2. Copy all the DLLs in the /ext directory to your WINDOWS\SYSTEM32 directory.
You might also want to add the following registry entry if it's not already there:

HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath = C:\php <-- Substitute with your PHP path
posted by Civil_Disobedient at 5:27 AM on January 27, 2010


Have you checked the file security for test.php in IIS Manager? In IIS Manager, right-click on the test.php file, select Properties. Go to the File Security tab. Click the "Edit" button in the "Authentication and access control" area. Compare file settings between test.sap and test.php.
posted by McGuillicuddy at 5:56 AM on January 27, 2010


Try giving the file and directory read write - full access to (from memory) "Network User" then iisreset and see how you go.
posted by mattoxic at 6:03 AM on January 27, 2010


Sorry if I sound condescending here, and i've not looked at the video, but have you actually tried restarting said PC?

I was banging my head against the wall for hours trying to get PHP to work on IIS6... until i finally decided to restart, and guess what, worked fine!!
posted by derbs at 6:09 AM on January 27, 2010


Going to deal with your suggestions one by one, thanks everyone.

Make sure your PHP directory is in the Windows PATH (Right-click My Computer -> Properties -> Advanced -> Environment Variables -> System variables -> "PATH"). Just add the PHP directory to the end of whatever's there (be sure to separate different paths with semicolons). Did this

Copy all the DLLs in the /ext directory to your WINDOWS\SYSTEM32 directory.
You might also want to add the following registry entry if it's not already there:

Did this too

HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath = C:\php <> In terms of this one there is no entry in this location for PHP! Did not implement as a consequence.

Started and restarted. No dice!

posted by therubettes at 6:36 AM on January 27, 2010


Have you checked the file security for test.php in IIS Manager? In IIS Manager, right-click on the test.php file, select Properties. Go to the File Security tab. Click the "Edit" button in the "Authentication and access control" area. Compare file settings between test.sap and test.php.

Compared both and they are identical. The dialog is titled Authentication Methods
The enable anonymous access checkbox is ticked and the IUSER_MACHINE_Name is in there.
posted by therubettes at 6:43 AM on January 27, 2010


Does the php file have Execute permissions?
posted by advicepig at 6:47 AM on January 27, 2010


Try giving the file and directory read write - full access to (from memory) "Network User" then iisreset and see how you go.

Gave individual files and directory full write access via ISS, restarted and no dice.

Going to take it off again now as I feel it could be make the server insecure!
posted by therubettes at 6:47 AM on January 27, 2010


Does the php file have Execute permissions? Yes:
Screen of the dialog
posted by therubettes at 6:50 AM on January 27, 2010


Try giving the file and directory read write - full access to (from memory) "Network User" then iisreset and see how you go

Tried it mattoxic, no good I am afraid.
posted by therubettes at 6:55 AM on January 27, 2010


Sorry if I sound condescending here, and i've not looked at the video, but have you actually tried restarting said PC?

I was banging my head against the wall for hours trying to get PHP to work on IIS6... until i finally decided to restart, and guess what, worked fine!!


Derbs you dont sound condescening at all, I am hoping that it is something simple and I would prefer for it to be the stupidest gotcha ever and easy to solve rather than an un-fixable bug.

I am going to give this thread another hour or so and then I am going to restart.
posted by therubettes at 6:56 AM on January 27, 2010


Since PHP runs so crappily on IIS, have you considered getting a separate box so you can run a full LAMP stack and take IIS + Windows out of the equation? Or, barring that, some sort of virtualization solution so you ca run the two side-by-side on the same box? I'm not saying this as a "Windoze sux dude!!!" thing. I'm suggesting it purely as a pragmatic solution.
posted by wheat at 7:07 AM on January 27, 2010


Is this thread any help?
posted by wheat at 7:09 AM on January 27, 2010


Since PHP runs so crappily on IIS, have you considered getting a separate box so you can run a full LAMP stack and take IIS + Windows out of the equation? Or, barring that, some sort of virtualization solution so you ca run the two side-by-side on the same box? I'm not saying this as a "Windoze sux dude!!!" thing. I'm suggesting it purely as a pragmatic solution.

Thanks for the suggestion, another box is probably not possible, in terms of the virtualization solution I suppose it is something that could work, but right now I am still hoping to solve this problem. And I appreciate you are not saying "Windoze sux dude!!!" but you may be thinking it and I am starting to think it too!!
posted by therubettes at 7:12 AM on January 27, 2010


Wheat I am going to look at the thread you suggested now and see if it does!
From first look it is kinda familiar but I have looked at so many forums at this point!

Btw thanks to everone who has helped so far, I appreciate it.
posted by therubettes at 7:13 AM on January 27, 2010


Ok a few things which may or may not help.

1 - Read that thread and tried the permissions suggestion.

2 - Tried the edit to php.ini which was suggested (I edited the php.ini in the c:\windows dir by the way.)

3 - While I am still allowing Anonymous Assess in the Authentication Methods dialog in IIS I un-checked Integrated Windows Security and I am no longer prompted for a username/password, just goes straight to the 'You are not authorized' page which I guess is progress.

4 - Another thing to mention is that in IIS .php files are assigned to php5isapi.dll and not php.exe, php-cgi.exe or php-win.exe from what I read specifying the dll is the most secure method.
posted by therubettes at 7:35 AM on January 27, 2010


Make sure your PHP directory is in the Windows PATH (Right-click My Computer -> Properties -> Advanced -> Environment Variables -> System variables -> "PATH"). Just add the PHP directory to the end of whatever's there (be sure to separate different paths with semicolons). Did this

Path changes sometimes require a reboot for whatever reason.
posted by damn dirty ape at 8:56 AM on January 27, 2010


Thanks - will try it later and hope for the best.
posted by therubettes at 11:19 AM on January 27, 2010


[removed links to server at poster's request]
posted by jessamyn (staff) at 5:21 AM on January 28, 2010


« Older THIS IS WHY WE CAN'T HAVE NICE THINGS!   |   What book best enhances the experience of being in... Newer »
This thread is closed to new comments.