当前位置:首页 > 雷神校园团队 > 正文

解决IIS7.5无法使用php7

标题的意思不是说IIS7.5不支持php7,而是生产环境出现了某些问题,具体如下:

偷懒使用宝塔将windows服务器做了环境配置,php部分选择全版本:

将写好的代码部署到服务器后发现如下报错:

HTTP 错误 500.0 - Internal Server Error

*\php\7.1\php-cgi.exe - FastCGI 进程意外退出

尝试更换php版本为5.6后正常运行

因为小幻说php7好用,加上我作为强迫症患者,自然也想用php7来加快运行效率,在宝塔的论坛查询后有人说是IIS7.5默认未安装FastCGI,需要下载独立的安装包进行安装,尝试无果。

那就只能自己判断问题所在咯~

因为报错是在php-cgi.exe这个程序上,所以定位到php-cgi.exe,双击运行,提示缺少api-ms-win-crt-runtimel1-1-0.dll,查了下这个api-ms-win-crt-runtimel1-1-0.dll是属于vc14的,想起php7基于vc14进行编译,故需要安装vc14。

将一个vc14的安装包传到服务器上安装:

灵异事件……这货我已经安装过了?

点击修复后发现有报错:

查看下日志文件:

第80行的报错:

[09C8:0C70][2017-06-03T01:03:31]e000: Error 0x80240017: Failed to execute MSU package.

未能执行MSU包,则证明上方有至少一个包安装失败,向上看,找最近的解包日志:

第76行的日志:

[13C0:02C8][2017-06-03T01:03:18]i301: Applying execute package: Windows7_MSU_x64, action: Install, path: C:\ProgramData\Package Cache\42D5BEC7DDFBD49E76467529CBC2868987BF8460\packages\Patch\x64\Windows6.1-KB2999226-x64.msu, arguments: '"C:\Windows\SysNative\wusa.exe" "C:\ProgramData\Package Cache\42D5BEC7DDFBD49E76467529CBC2868987BF8460\packages\Patch\x64\Windows6.1-KB2999226-x64.msu" /quiet /norestart'

看起来是安装的Windows6.1-KB2999226-x64.msu包存在问题。

在微软官方下载KB2999226-x64.msu,安装,提示报错:

用DISM强制解包安装,依旧部署失败,看来是还需要其余条件.

有人回答如下:

I would like to give you a background on Universal CRT this would help you in understanding as to why the system should be updated before installing vc_redist.x64.exe.
 A large portion of the C-runtime moved into the OS in Windows 10 (ucrtbase.dll) and is serviced just like any other OS DLL (e.g. kernel32.dll).  It is no longer serviced by Visual Studio directly.  MSU packages are the file type for Windows Updates.
 In order to get the Windows 10 Universal CRT to earlier OSes, Windows Update packages were created to bring this OS component downlevel.  KB2999226 brings the Windows 10 RTM Universal CRT to downlevel platforms (Windows Vista through Windows 8.1).  KB3118401 brings Windows 10 November Update to the Universal CRT to downlevel platforms.
 Windows XP (latest SP) is an exception here.  Windows Servicing does not provide downlevel packages for that OS, so Visual Studio (Visual C++) provides a mechanism to install the UCRT into System32 via the VCRedist and MSMs.
1. The Windows Universal Runtime is included in the VC Redist exe package as it has dependency on the Windows Universal Runtime (KB2999226).
Windows 10 is the only OS that ships the UCRT in-box.  All prior OSes obtain the UCRT via Windows Update only.  This applies to all Vista->8.1 and associated Server SKUs.

For Windows 7, 8, and 8.1 the Windows Universal Runtime must be installed via KB2999226. However it has a prerequisite update KB2919355 which contains updates that facilitate installing the KB2999226 package.

2. Why does KB2999226 not always install when the runtime is installed from the redistributable?  What could prevent KB2999226 from installing as part of the runtime?
The UCRT MSU included in the VCRedist is installed by making a call into the Windows Update service and the KB can fail to install based upon Windows Update service activity/state:
1) If the machine has not updated to the required servicing baseline, the UCRT MSU will be viewed as being “Not Applicable”.
Ensure KB2919355 is installed. Also, there were known issues with KB2919355  so before this the following hotfix should be installed.
KB2939087
KB2975061
2)            If the Windows Update service is installing other updates when the VCRedist installs, you can either see long delays or errors indicating the machine is busy.
a.            This one can be resolved by waiting and trying again later (which may be why installing via Windows Update UI at a later time succeeds).
3)            If the Windows Update service is in a non-ready state, you can see errors reflecting that.
a.            We recently investigated a failure with an error code indicating the WUSA service was shutting down.

3. To identify if the prerequisite KB2919355 is installed there are 2 options:
Registry key:
64bit hive
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Package_for_KB2919355~31bf3856ad364e35~amd64~~6.3.1.14
CurrentState = 112
32bit hive
HKLM\SOFTWARE\[WOW6432Node\]Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Package_for_KB2919355~31bf3856ad364e35~x86~~6.3.1.14
CurrentState = 112

Or check the file version of:
C:\Windows\SysWOW64\wuaueng.dll
C:\Windows\System32\wuaueng.dll
7.9.9600.17031  or later

重要部分翻译:

很大一部分的c运行时进入操作系统Windows 10(ucrtbase.dll)和服务就像任何其他操作系统DLL(例如kernel32.dll)。它不再直接由Visual Studio服务。MSU包是Windows更新的文件类型。

为了得到早十普遍CRT Windows操作系统,Windows更新包将创建这个底层操作系统组件。KB2999226将Windows 10 RTM通用CRT引入到downlevel平台(Windows Vista通过Windows 8.1)。KB3118401将windows10 11月10日更新到通用CRT平台。

Windows XP(最新SP)是一个例外。Windows服务不为操作系统提供降级包,因此Visual Studio(Visual c++)提供了一种机制,通过VCRedist和MSMs将UCRT安装到System32中。

1。Windows Universal运行时被包括在VC的reredist exe包中,因为它依赖于Windows Universal运行时(KB2999226)。

windows10是唯一一个在盒子里使用的操作系统。所有之前的OSes只通过Windows更新获得UCRT。这适用于所有的Vista - > 8.1和相关的服务器sku。

对于Windows 7、8和8.1,Windows Universal运行时必须通过KB2999226安装。但是它有一个先决条件更新KB2919355,其中包含更新,便于安装KB2999226包。

2。为什么KB2999226不总是在运行时安装到重新发行版时安装?什么可以防止KB2999226在运行时安装?

在VCRedist中包含的UCRT MSU通过调用Windows Update服务来安装,而KB则无法在Windows Update service活动/状态下安装:

如果机器没有更新到所需的服务基线,UCRT MSU将被视为“不适用”。

确保KB2919355安装。此外,在KB2919355中也存在一些已知的问题,因此在此之前应该安装下面的热修复。

KB2939087

KB2975061

按照他的说法,需要安装先决条件KB2919355来更新,然后才能安装KB2999226。

下载KB2919355,安装,重启,安装KB2999226,重启,安装vc14,完成。

重启IIS,发现php-cgi已经正常工作,报错解决咯~


 

欢迎加入电脑问题互助交流,群聊号码:865856349

文章标题:解决IIS7.5无法使用php7
本文作者:慕若曦
发表日期:2017-06-4 11:35 星期日    首发于    暮若夕
本文固定链接: https://www.muruoxi.com/1587.html
 
文章标签:
上一篇: 下一篇:

2 条评论

评论加载中...
  1. 板凳
    加拿大代写   

    感谢楼主的分享

    2017年6月20日 下午9:01 评论
  2. 沙发
    姜辰   

    膜拜大神

    2017年6月11日 下午2:36 评论

发表评论

╮( ̄▽ ̄)╭ |  (= ̄ω ̄=) |  (>﹏<) |  Σ( ° △ °|||)︴ |  Σ(っ °Д °;)っ |  X﹏X |  (╯-_-)╯╧╧

小提示:提交评论后刷新本页面即可看到隐藏的文件哦~
十年之约
加载中……