Windows8.1 64位下升级PHP-5.3.5至PHP-5.4.42的详细流程!

1、由于准备使用Yii 2.0框架,其需要 PHP 5.4 或更高版本,因此决定升级PHP版本;
2、现在环境为:Windows8.1 64、Apache 2.2.25(http://www.apache.org/)、MySQL-5.5.28、PHP-5.3.5、phpMyAdmin-4.2.9.1;

升级前环境截图

3、准备升级为:Windows8.1 64、Apache 2.4.12(http://www.apachelounge.com/)、MySQL-5.5.28、PHP-5.4.42、phpMyAdmin-4.2.9.1,主要是将PHP升级为5.4.42,Apache从VC6编辑的转换为VC9编译的,且升级为2.4.12;
4、打开网址:http://windows.php.net/download/#php-5.4-ts-VC9-x86 ,下载php-5.4.42-Win32-VC9-x86.zip;
5、阅读左侧提示文档:
Which version do I choose?

IIS

If you are using PHP as FastCGI with IIS you should use the Non-Thread Safe (NTS) versions of PHP.
Apache

Please use the Apache builds provided by Apache Lounge. They provide VC9, VC11 and VC14 builds of Apache for x86 and x64. We use their binaries to build the Apache SAPIs.

If you are using PHP as module with Apache builds from apache.org (not recommended) you need to use the older VC6 versions of PHP compiled with the legacy Visual Studio 6 compiler. Do NOT use VC9+ versions of PHP with the apache.org binaries.

With Apache you have to use the Thread Safe (TS) versions of PHP.
VC9, VC11 & VC14

More recent versions of PHP are built with VC9, VC11 or VC14 (Visual Studio 2008, 2012 or 2015 compiler respectively) and include improvements in performance and stability.

– The VC9 builds require you to have the Visual C++ Redistributable for Visual Studio 2008 SP1 x86 or x64 installed

– The VC11 builds require to have the Visual C++ Redistributable for Visual Studio 2012 x86 or x64 installed

– The VC14 builds require to have the Visual C++ Redistributable for Visual Studio 2015 x86 or x64 installed

其大概意思翻译为:

我该选择哪个版本?
IIS
如果您使用的是PHP作为FastCGI的使用IIS,你应该使用非线程安全(NTS)版本的PHP。
阿帕奇
请使用由Apache Lounge提供的Apache。它们提供VC9,VC11和VC14建立的Apache,可用于x86和x64。我们用自己的二进制代码来构建Apache的SAPIs。
如果您使用的是PHP与Apache模块构建从apache.org(不推荐),你需要使用PHP的较老版本VC6与传统的Visual Studio 6编译器编译。不要使用VC9 +版本的PHP与apache.org二进制文件。

注:Windows版本的Apache1和Apache2使用VC6编译,因此要想在Windows下使用官方Apache+PHP,就必须要使用VC6版本,以兼容官方的Apache,而不能使用VC9版本编译的PHP,因为之间存在不兼容。现在PHP 5.4以上版本不提供VC6的,有两种方案,1:编译出一个5.4的VC6版本(因为过老,PHP官方已经放弃,不推荐),2:让Apache编译出一个VC9的版本,其本质上就是让Apache兼容PHP,Apache Lounge就提供了VC9以上的版本;

6、如果只是升级PHP至5.4.42,发现也是可以使用的,截图如下:

暂时只升级PHP版本,Apache仍然为官方软件;

根据PHP官方的提示,虽然运行PHP程序没有问题,但是理论上来说还是存在兼容性问题的,因此决定升级Apache为VC9版本;

7、卸载Apache 2.2.25(http://www.apache.org/) 截图如下:

卸载Apache 2.2.25(http://www.apache.org/)

8、安装Apache 2.4.12(http://www.apachelounge.com/),具体下载地址为:http://www.apachelounge.com/download/additional/:
复制D:\软件\httpd-2.4.12-win32-VC9\Apache24至C:\Apache24

9、在DOS窗口启动Apache:

在DOS窗口启动Apache

10、解决AH00112错误流程如下:

11、解决AH00112错误成功;

解决AH00112错误成功

12、解决AH00558错误:

解决AH00558错误

13、解决(OS 10048),原因在于多次运行同一命令,而Apache进行已经启用的缘故,因此在调试错误之前,建议关闭相应进程;

(OS 10048)的处理

结束Apache进程

14、将Apache安装为服务:

将Apache安装为服务

15、报错,权限不足,应该以Administrator运行,以管理员身份运行cmd.exe(命令提示符(管理员)(A)):

命令提示符(管理员)(A),将Apache安装为服务

16、双击ApacheMonitor.exe,或把它放在你的启动文件夹中

将Apache放置通知区域中

17、phpinfo运行截图

phpinfo运行截图

永夜