Windows7 64位新系统中Apache2.4无法运行的解决方案求助
Solutions for Your Apache & XAMPP Issues on Windows 7 64-bit
Hey there, let’s work through your problems one by one to get your Drupal 8 development environment up and running smoothly.
First: Fix the "Port 80 in use by PID 4" Error
That PID 4 is almost always Windows' built-in HTTP.sys service, which handles system-level HTTP traffic (often tied to IIS, Windows Update, or other system services). Here are two reliable fixes:
Option 1: Reconfigure Apache to use different ports
This is the safest approach if you don’t want to mess with system services:
- Open your XAMPP Apache config folder (usually
C:\xampp\apache\conf). - Edit
httpd.conf:- Change
Listen 80toListen 8080 - Change
ServerName localhost:80toServerName localhost:8080
- Change
- Edit
httpd-ssl.conf(inconf/extra):- Change
Listen 443toListen 4433
- Change
- Restart Apache from the XAMPP control panel. Now you’ll access your local site at
http://localhost:8080.
Option 2: Stop the service blocking Port 80
If you want to keep using Port 80:
- Open Command Prompt as Administrator.
- Run this command to confirm the service tied to PID 4:
You’ll see it’s linked totasklist /svc /fi "PID eq 4"HTTP.sys. - Stop the associated services:
- Open the Services manager (press Win+R, type
services.msc). - Find World Wide Web Publishing Service (IIS) – if it’s running, stop it and set its startup type to Manual.
- Also check for Windows Process Activation Service and stop it if needed.
- Open the Services manager (press Win+R, type
- To prevent this from happening on reboot, run this admin command:
Note: This might affect some system features like Windows Update. If you run into issues later, revert it withsc config http start= disabledsc config http start= auto.
Second: Fix the XAMPP 7.x "0xc000007b" Error
This error usually stems from 32/64-bit incompatibility or missing Visual C++ runtime libraries. Here’s how to fix it:
- Use a Win7-compatible XAMPP version: Newer XAMPP 7.x builds dropped support for Windows 7. Stick with XAMPP 7.2.x (the last version to support Win7) – make sure you download the 64-bit installer to match your system.
- Install required Visual C++ Redistributables: XAMPP 7.2 relies on the VC++ 2015-2019 Redistributable (64-bit). Download and install this from Microsoft’s official site.
- Reinstall XAMPP properly:
- Delete any existing XAMPP folders to avoid leftover files.
- Right-click the installer and select Run as Administrator.
- Install to a path with no spaces or special characters (e.g.,
C:\xamppinstead ofC:\Program Files\XAMPP).
Alternative: Manually Set Up Apache 2.4 + PHP 5.5.9
If you prefer more control, you can build the environment manually to match Drupal 8’s requirements:
- Download Apache 2.4 (64-bit, VC11 compiled – since PHP 5.5.9 uses VC11).
- Download PHP 5.5.9 (64-bit, VC11, match the Thread Safe/Non-Thread Safe build to your Apache version).
- Configure Apache’s
httpd.confto load the PHP module:LoadModule php5_module "C:/php/php5apache2_4.dll" AddHandler application/x-httpd-php .php PHPIniDir "C:/php" - Copy
php.ini-developmenttophp.iniand adjust settings likeextension_dirto point to your PHP extensions folder.
内容的提问来源于stack exchange,提问作者Georges Amos
相关产品推荐
相关产品推荐

