没有不值得去解决的问题,也没有不值得去学习的技术!

Detailed Steps to Upgrade PHP-5.3.5 to PHP-5.4.42 on Windows 8.1 64-bit

Screenshot of phpinfo running

1. Because I plan to use the Yii 2.0 framework, which requires PHP 5.4 or higher, I decided to upgrade the PHP version;
2. The current environment is: Windows 8.1 64-bit, Apache 2.2.25 (http://www.apache.org/), MySQL-5.5.28, PHP-5.3.5, phpMyAdmin-4.2.9.1;

Screenshot of the environment before the upgrade
Screenshot of the environment before the upgrade

3. The target environment for the upgrade is: Windows 8.1 64-bit, Apache 2.4.12 (http://www.apachelounge.com/), MySQL-5.5.28, PHP-5.4.42, phpMyAdmin-4.2.9.1. The main changes are upgrading PHP to 5.4.42 and switching Apache from a VC6 build to a VC9 build, upgrading it to version 2.4.12;
4. Opened the URL: http://windows.php.net/download/#php-5.4-ts-VC9-x86 and downloaded php-5.4.42-Win32-VC9-x86.zip;
5. Read the documentation on the left:
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

The general meaning translates to:

Which version should 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 a 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.

Note: Windows versions of Apache 1 and Apache 2 are compiled with VC6, so to use the official Apache with PHP on Windows, you must use the VC6 version for compatibility with the official Apache. You cannot use PHP compiled with VC9 because of incompatibilities between them. PHP 5.4 and above no longer provide VC6 versions, leaving two options: 1. Compile a VC6 version of 5.4 (not recommended because it is outdated and officially abandoned by PHP); 2. Use a VC9 build of Apache, which essentially makes Apache compatible with PHP. Apache Lounge provides VC9 and above versions;

6. If you only upgrade PHP to 5.4.42, you will find that it still works, as shown in the screenshot below:

Temporarily upgrading only the PHP version, Apache remains the official software;
Temporarily upgrading only the PHP version, Apache remains the official software;

According to the official PHP guidelines, although running PHP programs poses no issues, there are theoretically still compatibility problems, so I decided to upgrade Apache to the VC9 version;

7. Uninstalled Apache 2.2.25 (http://www.apache.org/), screenshot below:

Uninstalling Apache 2.2.25 (http://www.apache.org/)
Uninstalling Apache 2.2.25 (http://www.apache.org/)

8. Install Apache 2.4.12 (http://www.apachelounge.com/), the specific download URL is: http://www.apachelounge.com/download/additional/:
Copy D:\软件\httpd-2.4.12-win32-VC9\Apache24 to C:\Apache24

9. Start Apache in a DOS window:

Starting Apache in a DOS window
Starting Apache in a DOS window

10. The process for resolving the AH00112 error is as follows:

9.2

11. Successfully resolved the AH00112 error;

Successfully resolved the AH00112 error
Successfully resolved the AH00112 error

12. Resolve the AH00558 error:

Resolving the AH00558 error
Resolving the AH00558 error

13. Resolved (OS 10048); the cause was running the same command multiple times while the Apache process was already running. Therefore, before debugging errors, it is recommended to close the corresponding process;

Handling (OS 10048)
Handling (OS 10048)
Ending the Apache process
Ending the Apache process

14. Install Apache as a service:

Installing Apache as a service
Installing Apache as a service

15. An error occurred due to insufficient permissions; it should be run as an Administrator. Run cmd.exe (Command Prompt (Admin) (A)) as an administrator:

Command Prompt (Admin) (A), installing Apache as a service
Command Prompt (Admin) (A), installing Apache as a service

16. Double-click ApacheMonitor.exe, or place it in your Startup folder.

Placing Apache in the notification area
Placing Apache in the notification area

17. Screenshot of phpinfo running

Screenshot of phpinfo running
Screenshot of phpinfo running

关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系