Apache and PHP cannot start problem summary under Windows system

  • 2020-05-13 04:06:22
  • OfStack

Recently, I have often been asked the problem that Apache cannot be started, so I wrote an article to summarize the solutions to the problem that Windows often encounters when Apache/PHP cannot be started.

Apache/PHP cannot be started in two cases:

1. Apache cannot be started, and php cannot be started without loading
2. Apache can be started, but it cannot be started after loading php

The first case is mostly an Apache configuration problem, or port 80 is occupied

Configuration checks using Apache:


C:\>D:\Apache2.2\bin\httpd.exe -t
Syntax OK

Correct the error according to the error prompt.
If port 80 is occupied, this is common on Windows machines and is often preempted by IIS.

Unsubscribe IIS service:


iisreset /stop
iisreset /disable sc stop w3svc
sc delete w3svc

If not IIS, you can use the command to kill the process occupying port 80:


# Find the footprint 80 Port process pid
netstat -ano|find ":80" # Suppose the process pid for 2013 , see process name:
tasklist /fi "pid eq 2013" # Kill the process command
taskkill /f /pid 2013

If this is not the case, it could be a system network issue, with the following warning:


setup_inherited_listeners(), WSASocket failed to open the
inherited socket.

Repair the Windows network using the command:

netsh winsock reset

Restart the machine. If the problem cannot be solved, try the following methods:

Local connection - > Property - > Advanced - > Wins tags - > Remove the check before enabling LMhosts query


/********  The merciless dividing line ********* /
  Akik no flowering trees
/ *******   ruthless copy  *********/

The second is mostly a problem with the PHP compiler:

Check the Apache error log for something like the following:


httpd.exe: Syntax error on line 63 of D:/Apache2.2/conf/httpd.conf: Cannot load D:/php/php5apache2_4.dll into server: %1 \xb2\xbb\xca\xc7\xd3\xd0\xd0\xa7\xb5\xc4 Win32 \xd3\xa6\xd3\xc3\xb3\xcc\xd0\xf2\xa1\xa3

The compilers used by php5.5 are vc11, php5.4 and php5.3, vc9 and php5.2 are vc6. Also note whether it is the x86 version or the x64 version. Currently, only php5.5 is available in x64 version, while others only have x86 version.
apache.org all Apache downloaded are versions of vc6; otherwise, different runtime libraries are installed according to different file instructions.

vc11 runtime x86 / x64 version: http: / / www microsoft. com/en - us/download/details aspx & # 63; id = 30679
vc10 runtime x86 version: http: / / www microsoft. com/en - us/download/details aspx & # 63; id = 5555
vc10 runtime x64 version: http: / / www microsoft. com/en - us/download/details aspx & # 63; id = 14632
vc9 runtime x86 version: http: / / www microsoft. com/en - us/download/details aspx & # 63; id = 5582
vc9 runtime x64 version: http: / / www microsoft. com/en - us/download/details aspx & # 63; id = 15336
If you don't know your situation, you can install the entire runtime and never have to worry about it again.

If Apache/PHP cannot be started, it is most likely a problem with the php5_module module:

1. The module PHP corresponding to Apache2.0 is php5apache2.dll
2. Apache2.2 the corresponding PHP module is php5apache2_2.dll
3. Apache2.4 corresponding PHP module is php5apache2_4.dll

In other words, according to the php5_module module, you can know which Apache is supported by the current version of php

Therefore, Apache/PHP can be used in the following ways:

1. php5.2 supports Apache2.0 and Apache2.2;
2. php5.3, php5.4 support Apache2.2 and Apache2.4 at the same time;
3. php5.5 only supports Apache2.4

Unless you manually compile the php5_module module yourself, there are only three options.

If Apache/PHP still fails to start, check that the php configuration (php.ini) exists and that running php.exe does not prompt an error. Correct the error according to the error prompt.


Related articles: