First I tried to set PHP working with Apache but there was a big problem with the php5apache2_2.dll (and some dependencies I detected with depends.exe) I couldn't come over. So I deinstalled Apache and decided to use IIS instead.
Since IIS was first deinstalled when I was using Apache, I added this role again, including the CGI and ISAPI options. I opened "Handler mappings" and added the proper module mapping for the *.php files which uses the c:\php\php-cgi.exe executable (where the c:\php folder contains the non-thread-safe version of PHP 5.5.12, taken from http://windows.php.net/download/).
Then I modified the php.ini file by enabling/adding the following lines:
cgi.fix_pathinfo = 1
fastcgi.impersonate = 1
cgi.force_redirect = 0
extension_dir = "ext"
But the problem is, nothing still works because the http://localhost (or http://127.0.0.1) is pointing nowhere. "The webpage cannot be found" 404 error appears, probably because of the reinstallation of the IIS role.
I made a "Default site" and made a binding to the address of the server (let's call it xx.yy.zz.qq) on port 80, pointing on the "c:\inetpub\wwwroot\default_site" folder. When I click browse inside the IIS manager (equivalent of putting http:\\xx.yy.zz.qq in the browser), it works. It shows the content of the folder with one test file inside (phpinfo.php). But when I try to put http:\\xx.yy.zz.qq\phpinfo.php in the browser, the "HTTP 500 Internal Server Error" error appears. PHP isn't working regardless of the localhost issue.
Is there something generally wrong with my IIS or what?
OK. I reinstalled the whole 2008 R2 operating system and tried again. I followed the Sparkingnaz steps.
I used the 5.5.12 version of PHP, installed both 2012 and 2008 C++ redistributable packages, modified php.ini (but didn't uncomment any extension) and granted the IIS_IUSRS account rights both on d:\php and d:\www folders.
But the thing doesn't work:
HTTP Error 500.0 - Internal Server Error D:\PHP\php-cgi.exe - The FastCGI process exited unexpectedly
Most likely causes:
IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.
IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
IIS was not able to process configuration for the Web site or application.
The authenticated user does not have permission to use this DLL.
The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.
Things you can try:
Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account.
Check the event logs to see if any additional information was logged.
Verify the permissions for the DLL.
Install the .NET Extensibility feature if the request is mapped to a managed handler.
Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here.
I tried to install the .NET Extensibility Feature, but same error pops up.