How can I install PHP on a Windows machine using Internet Information Services (IIS)?
问题:
回答1:
This is more a guide than a question in the hope it helps many users who are looking for an easy beginner's proof installation guide:
First of all you need to have installed and running IIS on your machine, IIS doesn't comes by default, you have to add the characteristic from control panel -> Programs -> Windows Characteristics.
I had successfully installed PHP under IIS 5.1 (WinXP), IIS 7.5.7x (Win7) and IIS 10.0.10x (Windows 10) both x32 and x64 platforms and works great.
I resumed this guide in 10 easy steps:
- Download the PHP version you like from http://windows.php.net/download/ make sure you download the Non-Thread Safe (NTS) versions of PHP.
- Extract the files into 'C:\PHP\'.
- Open then 'Internet Information Services Administrator IIS'.
- Select the root item in the left panel.
- Double click on 'Handler Mappings' (Asignaciones de Controlador).
- On the right side panel click on 'Add Module Mapping' (Agregar asignacion de modulo..).
Setup the values like this:
Request Path: *.php Module: FastCgiModule Executable: C:\PHP\php-cgi.exe Name: PHP_FastCGI Request Restrictions: Folder or File, All Verbs, Access: Script
Install 'vcredist_x64.exe' o 'vcredist_x86.exe' (Visual C++ 2012 Redistributable) https://www.microsoft.com/en-US/download/details.aspx?id=30679
Setup your 'C:\PHP\php.ini', especially set the 'extension_dir ="C:\PHP\ext"'.
Reset Internet Information Services: In a command console type IISRESET.
Congratulations you have now PHP working on Windows!
Optionally you can install the 'PHP Manager for IIS' https://phpmanager.codeplex.com/ which is of great help to setup the ini file and track the log of errors (sadly It doesn't works on Win10 as far i know).
Remember to set 'index.php' as one of the default documents for IIS.
Glad to help.