简体   繁体   English

XAMPP:无法启动 Apache (Windows 10)

[英]XAMPP: Couldn't start Apache (Windows 10)

I'm using XAMPP, and I can start Apache, but, MySQL ( phpMyAdmin ) start!我正在使用 XAMPP,我可以启动 Apache,但是,MySQL ( phpMyAdmin ) 启动!

When I start, I get this error;当我开始时,我收到这个错误;

10:07:49 [Apache] Error: Apache shutdown unexpectedly.
10:07:49 [Apache] This may be due to a blocked port, missing dependencies,
10:07:49 [Apache] improper privileges, a crash, or a shutdown by another method.
10:07:49 [Apache] Press the Logs button to view error logs and check
10:07:49 [Apache] the Windows Event Viewer for more clues
10:07:49 [Apache] If you need more help, copy and post this
10:07:49 [Apache] entire log window on the forums

I search on it, and, change the port of Apache in Config -> Service and Port setting.我搜索它,然后在配置 -> 服务和端口设置中更改 Apache 的端口。 I have;我有;

Service name: Apache 2.4
Main port: 122
SSL port: 444

I also uninstall Skype (Windows 8/10/Metro version).我也卸载了 Skype(Windows 8/10/Metro 版本)。 Nothing is working.没有任何工作。 In the httpd.conf file I have;在我有的httpd.conf文件中;

Listen 122
ServerName localhost:122

I start it via apache_start.bat and get;我通过apache_start.bat启动它并得到;

(OS 10013)An attempt was made to access a socket in a way forbidden by its access permissions.  : AH00072: make_sock: could not bind to address [::]:445
(OS 10013)An attempt was made to access a socket in a way forbidden by its access permissions.  : AH00072: make_sock: could not bind to address 0.0.0.0:445
AH00451: no listening sockets available, shutting down
AH00015: Unable to open logs

Please note that all the log files don't exists!请注意,所有日志文件都不存在! Skype is uninstalled. Skype 已卸载。

Update: 15th May, 2018:更新:2018 年 5 月 15 日:

The latest Windows 10 update (re-)activated the World Wide Web Publishing Service (in German: WWW-Publishingdienst ).最新的 Windows 10 更新(重新)激活了万维网发布服务(德语: WWW-Publishingdienst )。 This might depend on the options you select during the configuration of the update you can make afterwards.这可能取决于您在配置更新期间选择的选项,然后您可以进行更新。

Update: 4th August, 2015:更新:2015 年 8 月 4 日:

If you have done clean installation of Windows 10, you may not have the Word Wide Web Publishing Service .如果您已完成 Windows 10 的全新安装,则您可能没有Word Wide Web Publishing Service In that case, simple WAMP/XAMPP installation should work fine.在这种情况下,简单的 WAMP/XAMPP 安装应该可以正常工作。

If it doesn't, try installing Visual C++ Redistributable and then re-install WAMP/XAMPP.如果没有,请尝试安装Visual C++ Redistributable ,然后重新安装 WAMP/XAMPP。


I was facing a similar problem with WAMP.我在使用 WAMP 时遇到了类似的问题。 In Windows 10 TP, the Word Wide Web Publishing Service comes pre-installed.在 Windows 10 TP 中,预装了Word Wide Web Publishing Service This is related to IIS and you can remove it if you don't need it.这与 IIS 相关,如果不需要,可以将其删除。

This blocks the port 80 , making Apache act weirdly.这会阻止端口80 ,使 Apache 行为异常。 You can do the following and try again.您可以执行以下操作并重试。

  • Go to Start, type in services.msc转到开始,输入services.msc
  • Scroll down in the Services window to find the World Wide Web Publishing Service .在“服务”窗口中向下滚动以查找万维网发布服务
  • Right click on it and select Stop .右键单击它并选择停止

This should make port 80 free and restarting WAMP/XAMPP should get you up and running!这应该会使端口80空闲,并且重新启动 WAMP/XAMPP 应该会让您启动并运行!

There are other ways to do fix this.还有其他方法可以解决这个问题。 See Make WAMP Work On Windows 10 .请参阅使 WAMP 在 Windows 10 上工作

Solving this problem is easy:解决这个问题很容易:

  1. Open a command prompt with administrator privileges以管理员权限打开命令提示符
    • Find "cmd", right-click on it, then select "Administrator".找到“cmd”,右键单击它,然后选择“管理员”。
  2. In the prompt, type net stop W3SVC and Enter.在提示中,输入net stop W3SVC并回车。

You can now click in WAMPP and restart all services.您现在可以单击 WAMPP 并重新启动所有服务。 Open your browser and navigate to "localhost".打开浏览器并导航到“localhost”。

If you need to start W3SVC again,如果您需要再次启动 W3SVC,

  1. Open a command prompt with administrator privileges以管理员权限打开命令提示符
  2. In the prompt, type net start W3SVC and Enter.在提示中,输入net start W3SVC并回车。

I found a way to solve this problem:我找到了解决这个问题的方法:

  1. If you are using Skype as well, uncheck the field stating to use ports 80 and 443 (Extra -> Settings -> Advanced -> Connections -> Uncheck Port 80 and 443)如果您也使用 Skype,请取消选中声明使用端口 80 和 443 的字段(额外 -> 设置 -> 高级 -> 连接 -> 取消选中端口 80 和 443)
  2. Restart Skype and XAMPP.重新启动 Skype 和 XAMPP。

If this does not work,如果这不起作用,

  1. Go to Start and type "services.msc"转到“开始”并键入“services.msc”
  2. Locate "World Wide Web Publishing Service"找到“万维网发布服务”
  3. Right-click on that entry, select "Stop", then restart XAMPP.右键单击该条目,选择“停止”,然后重新启动 XAMPP。

If that did not work and "World Wide Web Publishing Service" was not available,如果这不起作用并且“万维网发布服务”不可用,

  1. Go to the Control Panel, navigate to "Uninstall Programs", then "Turn on/off Windows features"转到控制面板,导航到“卸载程序”,然后“打开/关闭 Windows 功能”
  2. Locate "Internet Information Services"找到“互联网信息服务”
  3. Click the checkbox and hit "OK".单击复选框并点击“确定”。
  4. Restart, then repeat the second approach (services.msc)重新启动,然后重复第二种方法(services.msc)

You can change the port of Apache:您可以更改Apache的端口:

  1. Go to C:\\xampp\\apache\\conf\\httpd.转到 C:\\xampp\\apache\\conf\\httpd。
  2. Find by combination Ctrl+F line #Listen 12.34.56.78:80 and change the 80 to any you like for example 81通过组合 Ctrl+F 行查找 #Listen 12.34.56.78:80 并将 80 更改为任何您喜欢的,例如 81
  3. The same with Listen 80 change to 81同听 80 改为 81
  4. The same with ServerName localhost:80 change to 81.同样与ServerName localhost:80 更改为81。
  5. Go to C:\\xampp\\apache\\conf\\extra\\httpd-vhosts and change 80 to 81转到 C:\\xampp\\apache\\conf\\extra\\httpd-vhosts 并将 80 更改为 81

NameVirtualHost *:80 here NameVirtualHost *:80 这里

VirtualHost *:80 and here (two times) VirtualHost *:80 和这里(两次)

  1. Restart Apache重启阿帕奇

To enter your web page, type: http://localhost:81/index.html要进入您的网页,请输入:http://localhost:81/index.html

  1. Press Windows + R , and type regedit .Windows + R ,然后键入regedit

  2. Go to

     HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\HTTP

    Change the value of Start to 4, which means disabled.Start的值更改为 4,表示禁用。

  3. Reboot your computer.重新启动计算机。

I have fixed this issue with mine as well, but I had to change a couple of things.我也解决了这个问题,但我不得不改变一些事情。 I require that on my Windows 10 machine I keep my C# and Visual Studio development environment, so I didn't want to tinker with any services.我要求在我的 Windows 10 机器上保留我的 C# 和 Visual Studio 开发环境,所以我不想修补任何服务。 All I had to do was download the latest version of XAMPP and change the listening ports for 80 and 443. They were located in two files:我所要做的就是下载最新版本的 XAMPP 并更改 80 和 443 的侦听端口。它们位于两个文件中:

C:\\xampp\\apache\\conf\\httpd.conf

Listen 122
ServerName localhost:122

C:\\xampp\\apache\\conf\\extra\\httpd-ssl.conf

Listen 444

Changing the above from port 80 to 122 and 443 to 444 allowed me to have Apache run and serve pages while keeping everything else the same for my ASP.NET development.将上面的端口从 80 更改为 122 并将 443 更改为 444 允许我运行 Apache 并提供页面,同时为我的ASP.NET开发保持其他所有内容相同。 Hopefully this helps someone out there.希望这可以帮助那里的人。 In the end this is a very simple fix.最后,这是一个非常简单的修复。

Direct your browser to: http://localhost:122将浏览器定向到: http://localhost:122

I tried everything listed in the answers here but none of them worked.我尝试了此处答案中列出的所有内容,但没有一个奏效。

Then all I did was to re-start XAMPP with administrator rights by:然后我所做的就是通过以下方式以管理员权限重新启动 XAMPP:

Start menu - right click on XAMPP - select run as administartor开始菜单 - 右键单击​​ XAMPP - 选择以管理员身份运行

It worked.有效。 It is that simple.就是这么简单。

I uninstalled IIS services, stopped WWW services, changed ports back to 80, blocked all apache and mysql connections from windows 10 firewall, but yes it still works!我卸载了 IIS 服务,停止了 WWW 服务,将端口更改回 80,阻止了来自 Windows 10 防火墙的所有 apache 和 mysql 连接,但是它仍然有效!

I got same problem, but the previous solutions leads us to change the port instead of getting the exact solution.我遇到了同样的问题,但之前的解决方案导致我们更改端口而不是获得确切的解决方案。 I've searched about the ports of simple HTTP & HTTPS Protocols and found.我搜索了简单的 HTTP 和 HTTPS 协议的端口并找到了。

If another application is already running, the HTTP or HTTPS ports on the local machine, we'll get this problem obviously just because of those ports already in use and in a busy state .如果另一个应用程序已经在运行,本地机器上的 HTTP 或 HTTPS 端口,我们显然会因为这些端口已经在使用并且处于繁忙状态而遇到这个问题

That's why after changing the port number it was working.这就是为什么在更改端口号后它可以工作的原因。 But instead of changing the port in the XAMPP server, I've used the following methods and it works for me.但是我没有更改 XAMPP 服务器中的端口,而是使用了以下方法,它对我有用。

Here's the following step which I've got during this fix up.这是我在此修复过程中完成的以下步骤。

  1. Error which I got in XAMPP Server application.我在 XAMPP 服务器应用程序中遇到的错误。

    XAMPP 服务器错误

  2. At the top corner there's a button named Netstat .在顶角有一个名为Netstat的按钮。 It's very useful for looking up the running ports on the system.它对于查找系统上正在运行的端口非常有用。

    网络状态按钮

  3. This is the Netstat application where I found an application already running and using the port number 443. In my case, it was vmware-hostd.exe .这是 Netstat 应用程序,我发现一个应用程序已经在运行并使用端口号 443。在我的例子中,它是vmware-hostd.exe Your might be a different application.您可能是不同的应用程序。 Try to search for port 80 (HTTP) or port 443 (HTTPS).尝试搜索端口 80 (HTTP) 或端口 443 (HTTPS)。

    Netstat 应用程序已打开

  4. I just opened the Windows Task Manager , selected that application vmware-hostd.exe , and killed the process by using the End Process button.我刚刚打开了 Windows任务管理器,选择了该应用程序vmware-hostd.exe ,并使用“结束进程”按钮终止了该进程 I've killed that process which was used port 443. And this application wasn't needed at the moment.我已经杀死了使用端口 443 的那个进程。目前不需要这个应用程序。

    打开任务管理器并杀死该应用程序

  5. After killing the application in Windows Task Manager, Apache is now available at the moment.在 Windows 任务管理器中杀死应用程序后,Apache 现在可用。 Here's the proof.这是证据。

    阿帕奇工作


NOTE: *If you found any kind of application which is used the HTTP or HTTPS ports means port 80 or port 443 and the application isn't important or not vital then only kill the process of that application.注意: *如果您发现使用HTTPHTTPS端口的任何类型的应用程序意味着端口80或端口443,并且该应用程序不重要或不重要,则仅终止该应用程序的进程。

Otherwise, there isn't any need to follow these steps.否则,无需执行这些步骤。 Then you need to consider to change the port of your XAMPP application as stated in the previous answers.*然后您需要考虑更改 XAMPP 应用程序的端口,如前面的答案所述。*

It looks like there are many options.看起来有很多选择。 The answer depends on your Windows installation.答案取决于您的 Windows 安装。 Here is my experience when having the same problem in a Windows 10 fresh install and fix the issue with the following step:这是我在 Windows 10 全新安装中遇到相同问题时的经验,并通过以下步骤解决问题:

  1. Install Visual C++ Redistributable安装Visual C++ Redistributable
  2. Open XAMPP and select configure in the Apache service打开XAMPP,在Apache服务中选择configure
  3. Change the port 80 to 9000 or 81 or whatever you want in file httpd.conf on the line Listen 80将端口 80 更改为 9000 或 81 或任何您想要的文件httpd.conf中的Listen 80
  4. Change the port on httpd-ssl.conf and change Listen 443 to Listen 441更改 httpd-ssl.conf 上的端口并将Listen 443更改为Listen 441
  5. Restart XAMPP and start the Apache service.重新启动 XAMPP 并启动 Apache 服务。 It works for me.这个对我有用。

Note : I'm using XAMPP version 5.6.15 and XAMPP Control Panel version 3.2.2.注意:我使用的是 XAMPP 5.6.15 版和 XAMPP 控制面板 3.2.2 版。

After playing around, really all you have to do is change two lines in the httpd.conf file:玩完之后,实际上您要做的就是更改httpd.conf文件中的两行:

Change "Listen 80" to "Listen 122" (or anything else you want)“听 80”更改为“听 122” (或您想要的任何其他内容)

and

"ServerName Localhost:80" to "Localhost:122" (or the port you changed above) “ServerName Localhost:80”“Localhost:122” (或者你在上面更改的端口)

Then it all should fire right up :P那么这一切都应该立即启动:P

The World Wide Web Publishing service was not the only one responsible in my case.万维网发布服务并不是唯一对我负责的服务。

I have IIS installed, so I had to stop the whole HTTP service.我安装了 IIS,所以我不得不停止整个 HTTP 服务。

These are the commands that I've executed in CMD (as administrator):这些是我在 CMD 中执行的命令(以管理员身份):

net stop W3SVC
net stop http

在此处输入图片说明

Change the port number which port are available in your system By following ways通过以下方式更改系统中可用的端口号

1. First open the Apache “httpd.conf” file: 1.首先打开Apache“httpd.conf”文件:

#Listen 12.34.56.78:80
Listen 80
ServerName localhost:80

to

#Listen 12.34.56.78:8080
Listen 8080
ServerName localhost:8080

2. Open httpd-ssl.conf: 2. 打开httpd-ssl.conf:

Listen 443
<VirtualHost _default_:443>

to

Listen 441
<VirtualHost _default_:441>

3. Follow the trick. 3. 跟着技巧走。 Now “Start” Apache and if everything goes well, your Apache server should start up.现在“启动”Apache,如果一切顺利,您的 Apache 服务器应该会启动。

  • Go to the start menu, and type Turn Windows features on or off转到开始菜单,然后键入打开或关闭 Windows 功能
  • Uncheck Internet Information Services取消选中Internet 信息服务
  • Press OK确定

Actually, by default IIS (Microsoft, .NET, etc.) is installed.实际上,默认情况下会安装 IIS(Microsoft、.NET 等)。

  • Go to Control Panel进入控制面板
  • Turn Windows features on or off...打开或关闭 Windows 功能...
  • Under (IIS) Internet Information Services, uncheck the (WWWS) world wide web services.在 (IIS) Internet Information Services 下,取消选中 (WWWS) 万维网服务。
  • Click OK.单击确定。

This could be a permanent solution.这可能是一个永久的解决方案。 :) :)

This advice was great.这个建议很棒。 I had the same problem, but my solution was different, because I was so stupid, that I have renamed directory where XAMPP was located and since I had installed a lot of another programs I couldn't rename it back.我遇到了同样的问题,但我的解决方案不同,因为我太愚蠢了,我重命名了 XAMPP 所在的目录,而且由于我安装了很多其他程序,我无法将其重命名。

In my case there was original directory C:\\Programs\\Xampp and renamed it to C:\\PROGRAMS_\\Xampp and that was the mistake.在我的情况下,有原始目录C:\\Programs\\Xampp并将其重命名为C:\\PROGRAMS_\\Xampp ,这就是错误。

The solution was to find all references on C:\\Programs and rename them C:\\PROGRAMS_ in the XAMPP directory, because for some reason during the installation it writes absolute paths, not relative.解决方案是找到C:\\Programs上的所有引用并将它们重命名为 XAMPP 目录中的C:\\PROGRAMS_ ,因为在安装过程中由于某种原因它写入的是绝对路径,而不是相对路径。 Of course, there are some references in the registry too.当然,注册表中也有一些引用。

It's simply a matter of making port 80 available for your Apache service.这只是让端口 80 可用于您的 Apache 服务的问题。 The way I solved the problem was:我解决问题的方法是:

  1. On Windows 10, right click the start button and select Run在 Windows 10 上,右键单击开始按钮并选择运行
  2. Type services.msc and click OK键入services.msc并单击确定
  3. Find and right click World wide web publishing service找到并右键单击万维网发布服务
  4. Select Properties选择属性
  5. Change the Startup type value to Automatic (Delayed Start)启动类型值更改为自动(延迟启动)
  6. Restart your computer.重启你的电脑。

There you have it.你有它。 All is back to normal.一切恢复正常。

In my case it was a simple case of removing IIS because Windows 10 comes with IIS (Internet Information Service) pre installed - that conflicts with XAMPP because these both servers try to use the port 80. If you don't want to use IIS and keep using XAMPP就我而言,这是删除 IIS 的一个简单案例,因为 Windows 10 预装了 IIS(Internet 信息服务) - 这与 XAMPP 冲突,因为这两个服务器都尝试使用端口 80。如果您不想使用 IIS 和继续使用 XAMPP

  1. Go to run/search in Windows 10在 Windows 10 中运行/搜索
  2. Search for 'optional features'搜索“可选功能”
  3. On that list untick Internet Information Service (IIS)在该列表中,取消勾选Internet Information Service (IIS)

Then restart .然后重新启动

That was simple for me!这对我来说很简单!

Try to run the XAMPP Control Panel as administrator.尝试以管理员身份运行 XAMPP 控制面板。

I have tried all the above solutions.我已经尝试了上述所有解决方案。 But it was not working in any way.但它没有以任何方式工作。

Finally, I just uninstalled XAMPP and installed it again .最后,我只是卸载了XAMPP 并重新安装了它 Then it worked for me.然后它对我有用。

Now I am able to run the server on any port (including 80).现在我可以在任何端口(包括 80)上运行服务器

I found that running apache_start in gave me the exact error and on which line it was.我发现运行 apache_start 给了我确切的错误以及它在哪一行。

My error was that I left a space in between localhost: and the port.我的错误是我在localhost:和端口之间留了一个空格。

If you have installed SQL Server , some of its services may block the port which XAMPP needs.如果你已经安装了SQL Server ,它的一些服务可能会阻塞 XAMPP 需要的端口。 I solved my problem by disablingSQL Server Reporting Services and now Apache starts without any problems.我通过禁用SQL Server Reporting Services解决了我的问题,现在 Apache 启动没有任何问题。

Just open the services.msc , scroll down, and find SQL Server Reporting Services .只需打开services.msc ,向下滚动,然后找到SQL Server Reporting Services Right click on it and click Stop .右键单击它并单击停止

Steps:脚步:

  • Open the XAMMP Control Panel打开 XAMMP 控制面板
  • Open Apache Config, and then select the Apache - xammp- configuration file打开Apache Config,然后选择Apache-xammp-配置文件
  • Search for "Port 443", and then change it to some other port, let's say 4433搜索“端口 443”,然后将其更改为其他端口,例如 4433
  • Then restart.然后重新启动。

Check if your PHP installation works.检查您的 PHP 安装是否有效。

Check which php.ini file you are running in Apache's configuration and use it to run php.exe...检查您在 Apache 的配置中运行的是哪个php.ini文件,并使用它来运行 php.exe...

You may just have updated your Windows to Version 1903 (OS Build:18362.239) or have changed user passwords.您可能刚刚将 Windows 更新到版本 1903(操作系统版本:18362.239)更改了用户密码。 Despite having eliminated all port conflicts , I still kept getting the messages described by the OP at the very start of this post.尽管已经消除了所有端口冲突,但我仍然不断收到 OP 在本文开头所描述的消息。

In the end I cured it by upgrading to XAMPP to 7.3.7.最后我通过升级到 XAMPP 到 7.3.7 来解决它。 (When forced to reinstall, you might as well upgrade at the same time!) (强制重装时,不妨同时升级!)

But the problem reoccurred when I again went to change the 'root' user password.但是当我再次更改“root”用户密码时,问题再次出现。

The console error messages were masking the fact that table mysql.user was corrupt.控制台错误消息掩盖了表mysql.user已损坏的事实。

Check file mysql_error.log .检查文件mysql_error.log If you are seeing Fatal error: Can't open and lock privilege tables: Index for table 'user' is corrupt;如果您看到致命错误:无法打开和锁定特权表:表“用户”的索引已损坏; try to repair it , then have a look at this .尝试修复它,然后看看这个

我遇到了同样的问题,我通过卸载WAMP服务器解决了它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM