IIS 8 Wont run PHP?
I think this may help you;
http://php.net/manual/en/install.windows.iis7.php
It says for iis7 and above, let me know if doesn't work and I'll dig deeper.
The process is;
1 - Configure CGI- and FastCGI settings in your php.ini such as
Fastcgi.impersonate = 1
fastcgi.logging = 0
cgi.fix_pathinfo = 1
cgi.force_redirect = 0
2 - Then in Windows type inetmgr into run under the start menu.
3 - Select the server node in the window that opens which is in the connections tree.
4 - In the central pane, known as the features view, openthe Handler Mappings feature.
5 - In the actions pane click **Add Module Mapping..."
6 - Use these details to fill in the blanks;
Request path: *.php
Module: FastCgiModule
Executable: C:\[path to php install]\php-cgi.exe
Name: PHP_via_FastCGI
7 - Click request restrictions and then configure the mapping to invoke handler only if request is mapped to a file or folder.
8 - Click okay on all dialogues to save the config.
The link at the top provides further information on configuration examples and how to do this from the command line. You should restart IIS once you're done.
James T
Updated on June 14, 2022Comments
-
James T almost 2 years
I was having permission issues with IIS 8.0 on my Windows Server 2012 box, so I decided to remove & re-add the role in an attempt to fix it.
This seems to have fixed my permission problems, but now my PHP wont work! I get this error when trying to access a
.php
fileHTTP Error 404.3 - Not Found
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.
Obviously what I need to do here is add a handler to one of the files in my php install folder (which I installed using the web app manager thing) but I don't know where I add a handler from? I know where to add MIME maps from but obviously that isn't going to solve this.
UPDATE: So I followed one of the answers which linked me to the PHP site, followed what it said and that seems to have fixed the PHP no running problem, but now thats opened a whole new can of worms. I'm getting the same
Access is denied
. error as before! even when i change file extensions to .html, it appears my site isnt directing to the default document, as when i go to www.mysite.co.uk, i get the error, but if i go to www.mysite.co.uk/index.php, it works fine! i have a index.php entry in my default documents, and a index.html, and neither seem to be working after the PHP installpermission on the root directory are full control to, Administrator, My user account, 'NETWORK SERVICE' and 'SYSTEM', just to note, i couldnt get the site to work at all without setting the 'connect as' option to my user account and password, so thats what its using to access the files.
-
Marcel Korpel over 10 yearsPlease describe in your answer what's in that link. Only posting a link renders this answer useless if the link is dead.
-
sgtbeano over 10 yearsApologies, will amend.
-
James T over 10 yearsThat seems to have worked, but now I'm getting the same
Access is denied.
error as before! even when i change file extensions to .html, it appears my site isnt directing to the default document, as when i go to www.mysite.co.uk, i get the error, but if i go to www.mysite.co.uk/index.php, it works fine! i have a index.php entry in my default documents, and a index.html, and neither seem to be working after the PHP install... does anybody have any idea whats going on and how i can fix it? -
sgtbeano over 10 yearsCan you check the permission on your folders? (post results in your original question)
-
sgtbeano over 10 yearsWhat's the output of [%windir%\system32\inetsrv\appcmd.exe list config localhost/websitename -section:defaultDocument]
-
James T over 10 yearsThat gives
ERROR ( message:Configuration error Filename: redirection.config Line Number: 0 Description: Cannot read configuration file due to insufficient permissions . )
-
sgtbeano over 10 yearsOkay, a couple of things to try. 1 - Grant access to the IIS_IUSER group for full control, then gradually remove permissions. 2 - Add index.php to your default document (found in the same place as the application handler, should be a page icon with default document underneath it)
-
James T over 10 yearsif i run it as administrator I get
The filename, directory name, or volume label syntax is incorrect
, im clearly using the command wrong either way... -
sgtbeano over 10 yearsAre you pasting it without the []? If not, then do.
-
James T over 10 yearsgot it working, heres the output:
<system.webServer> <defaultDocument enabled="true"> <files> <add value="index.php" /> </files> </defaultDocument> </system.webServer>
and for my other site that doesnt use PHP but uses ASP.NET but has the same problem, the output is<system.webServer> <defaultDocument enabled="true"> <files> <add value="Default.htm" /> <add value="Default.asp" /> <add value="index.html" /> <add value="default.aspx" /> </files> </defaultDocument> </system.webServer>
-
sgtbeano over 10 yearsDid you grant ISS_IUSER group yet? (as above)
-
James T over 10 yearsthe IIS_IUSER group doesnt exist apparently, so no. EDIT nevermind, googled it and apparently its IIS_IUSRS i presume you mean, granting access now
-
James T over 10 yearsgranting IIS_iUSRS full access solved it, thankyou very much sgtbeano!
-
sgtbeano over 10 yearsNo problem, but you will want to look into IIS 8 hardening as you're probably not very secure with all perms to IIS_IUSR group