【Azure App Service for Windows】 PHP应用出现500 : The page cannot be displayed because an internal server error has occurred. 错误
问题描述
PHP应用突然遇见了500 The page cannot be displayed because an internal server error has occurred.错误,但是如果访问一个静态HTML页面,就可以成功。只要是PHP页面,就是500。
问题解答
登录App Service的Kudu站点,查看日志发现一句: scriptProcessor could not be found in "fastCGI" application configuration.
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"> <System> <Provider Name="WWW Server" Guid="{3A2A4E84-4C21"/> <EventID>0</EventID> <Version>1</Version> <Level>3</Level> <Opcode>18</Opcode> <Keywords>0x100</Keywords> <TimeCreated SystemTime="2023-07-05T07:35:06.598Z"/> <Correlation ActivityID="{800003B}"/> <Execution ProcessID="6616" ThreadID="2832"/> <Computer>dw</Computer> </System> <EventData> <Data Name="ContextId">{8000031E-0000--}</Data> <Data Name="ErrorDescription"><handler> scriptProcessor could not be found in <fastCGI> application configuration</Data> </EventData> <RenderingInfo Culture="zh-CN"> <Opcode>SET_RESPONSE_ERROR_DESCRIPTION</Opcode> <Keywords> <Keyword>RequestNotifications</Keyword> </Keywords> </RenderingInfo> <ExtendedTracingInfo xmlns="http://schemas.microsoft.com/win/2004/08/events/trace"> <EventGuid>{00E}</EventGuid> </ExtendedTracingInfo> </Event>
错误消息显示因为脚本处理器(scriptProcessor)无法找到 fastCGI 模块。 而这个 fastCGI 是通过web.config配置,从App Service的实例中获取。
接下来,查看PHP的 FastCGI 处理程序 php_cgi.exe的路径。
然后,查看web.config中配置的路径,发现路径配置为D:\Program Files\...., 所以,尝试修改 FastCGI中 ScriptProcessor的路径为 C:\ 。
最后,保存修改。重新访问页面返回200成功。
解决了 scriptProcessor could not be found in "fastCGI" application configuration 问题。
当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
2022-07-05 【Azure 环境】 介绍两种常规的方法来监视Window系统的CPU高时的进程信息: Performance Monitor 和 Powershell Get-Counter