简体   繁体   English

使用IIS在Windows上安装PHP

[英]Instaling PHP on Windows with IIS

如何使用Internet Information Services(IIS)在Windows计算机上安装PHP?

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. 首先,您需要在计算机上安装并运行IIS,默认情况下没有IIS,您必须从控制面板->程序-> Windows特性中添加特性。

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. 我已经在x32和x64平台下的IIS 5.1(WinXP),IIS 7.5.7x(Win7)和IIS 10.0.10x(Windows 10)下成功安装了PHP,并且运行良好。

I resumed this guide in 10 easy steps: 我通过10个简单的步骤恢复了本指南:

  1. Download the PHP version you like from http://windows.php.net/download/ make sure you download the Non-Thread Safe (NTS) versions of PHP. http://windows.php.net/download/下载所需的PHP版本,并确保下载PHP的非线程安全(NTS)版本。
  2. Extract the files into 'C:\\PHP\\'. 将文件解压缩到“ C:\\ PHP \\”。
  3. Open then 'Internet Information Services Administrator IIS'. 然后打开“ Internet Information Services管理员IIS”。
  4. Select the root item in the left panel. 在左侧面板中选择根项目。
  5. Double click on 'Handler Mappings' (Asignaciones de Controlador). 双击“处理程序映射”(Asignaciones de Controlador)。
  6. On the right side panel click on 'Add Module Mapping' (Agregar asignacion de modulo..). 在右侧面板上,单击“添加模块映射”(Agregar asignacion demodulo ..)。
  7. 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

  8. Install 'vcredist_x64.exe' o 'vcredist_x86.exe' (Visual C++ 2012 Redistributable) https://www.microsoft.com/en-US/download/details.aspx?id=30679 安装'vcredist_x64.exe'或'vcredist_x86.exe'(Visual C ++ 2012 Redistributable) https://www.microsoft.com/zh-cn/download/details.aspx?id=30679

  9. Setup your 'C:\\PHP\\php.ini', especially set the 'extension_dir ="C:\\PHP\\ext"'. 设置您的'C:\\ PHP \\ php.ini',尤其是设置'extension_dir =“ C:\\ PHP \\ ext”'。

  10. Reset Internet Information Services: In a command console type IISRESET. 重置Internet信息服务:在命令控制台中,键入IISRESET。

Congratulations you have now PHP working on Windows! 恭喜,您现在可以在Windows上使用PHP!

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). (可选)您可以安装“用于IIS的PHP管理器” https://phpmanager.codeplex.com/ ,这对设置ini文件和跟踪错误日志有很大帮助(可惜,据我所知,它在Win10上不起作用)。

Remember to set 'index.php' as one of the default documents for IIS. 切记将“ index.php”设置为IIS的默认文档之一。

Glad to help. 乐意效劳。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM