Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS 8 Wont run PHP?

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 file

HTTP 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 install

permission 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.

like image 851
James T Avatar asked Feb 15 '23 17:02

James T


1 Answers

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.

like image 78
sgtbeano Avatar answered Feb 17 '23 09:02

sgtbeano