iis url-rewrite模块下载: https://www.iis.net/downloads/microsoft/url-rewrite
https://chat.qwen.ai/s/4c856ce0-2e2f-4d7f-8dc5-013f98a06572?fev=0.0.166
用户权限需要配置IIS_IUSRS用户
这个错误说明IIS找不到PHP的FastCGI处理器。这是PHP环境配置问题。
# 在命令行检查PHP是否安装
php -v如果没有安装PHP,需要先安装PHP。
- 打开IIS管理器
- 点击服务器节点(不是网站节点)
- 双击"FastCGI设置"
- 点击"添加应用程序"
- 设置:
- 完整路径:
C:\php\php-cgi.exe(根据实际路径调整) - 参数: 留空或根据需要添加
- 完整路径:
文件位置:C:\Windows\System32\inetsrv\config\applicationHost.config
在<system.webServer>/<fastCgi>节添加:
<fastCgi>
<application fullPath="C:\php\php-cgi.exe" maxInstances="4" />
</fastCgi>使用最基本的配置先测试:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<customErrors mode="Off" />
</system.web>
<system.webServer>
<httpErrors errorMode="Detailed" />
<directoryBrowse enabled="false" />
<handlers>
<add name="PHP-FastCGI" path="*.php" verb="*"
modules="FastCgiModule"
scriptProcessor="C:\php\php-cgi.exe"
resourceType="Unspecified" />
</handlers>
</system.webServer>
</configuration>C:\php\php-cgi.exe
C:\Program Files\PHP\v7.4\php-cgi.exe
C:\Program Files (x86)\PHP\v7.4\php-cgi.exe
在IIS管理器中查看"FastCGI设置"看是否已有配置。
iisreset
net stop w3svc
net start w3svc需要先安装PHP:
- 下载PHP for Windows: https://windows.php.net/download/
- 选择"Non Thread Safe"版本
- 解压到
C:\php\ - 配置php.ini文件
你现在能确认PHP是否已正确安装在服务器上了吗?如果不确定,可以运行php -v命令检查。