PHP:使用 WAMP 时出现内部服务器错误(启动时)

发布于 2024-09-15 15:00:06 字数 287 浏览 1 评论 0原文

我遇到了 php 问题。它显示如下错误。它在其他计算机上运行良好,但是当我尝试在另一台计算机上运行它时,它显示如下错误。我认为我的 wampserver 2.0 配置有问题。

内部服务器错误

服务器遇到内部错误或配置错误, 无法完成您的请求。请联系服务器 管理员,webmaster@localhost 并通知他们时间 发生错误,以及您可能执行的任何操作可能导致 有关此错误的更多信息可以在 服务器错误日志。

i had a problem wth php.It display error like below. It work well in other computer, but when i tried to run it in another computer it display error like below. I think i had a problem with my wampserver 2.0 configuration.

Internal Server Error

The server encountered an internal error or misconfiguration and was
unable to complete your request.Please contact the server
administrator, webmaster@localhost and inform them of the time the
error occurred, and anything you might have done that may have caused
the error.More information about this error may be available in the
server error log.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(11

不醒的梦 2024-09-22 15:00:06

这是由于 mod_rewrite 造成的。 WAMP 默认注释掉了这个选项。

您需要前往通知区域中的WAMP图标、Apache、httpd.config

搜索mod_rewrite,并将其取消注释。

之后重新启动WAMP,您就完成了!

Its due to mod_rewrite. WAMP had commented this option by default.

You need to go to WAMP icon in notification area, Apache, httpd.config

search for mod_rewrite, and uncomment it.

After that RESTART WAMP AND YOU ARE DONE!

混吃等死 2024-09-22 15:00:06

这是因为 mod_rewrite 模块在 Apache 的配置中被禁用:

  1. 如果您的网站托管在本地计算机上,您只需打开 Apache 的 conf 文件夹中的 httpd.conf 并搜索“mod_rewrite”即可。如果 mod_rewrite 行前面有一个 #,只需删除此 #,保存文件,然后重新启动 Apache。

  2. 如果您的网站托管在共享托管服务器上,那么您可能无权更改 Apache 的配置。因此,您必须要求您的托管管理员为您启用 mod_rewrite 模块。几乎每个共享托管提供商都已启用此功能。

This is because mod_rewrite module is disabled in your Apache's configuration:

  1. If your website is hosted at local machine you can simply open httpd.conf in Apaches's conf folder and search for "mod_rewrite". If mod_rewrite line is having a # in front of it, just remove this #, save file, and restart Apache.

  2. If your website is hosted at shared hosting server then you may not have privileges to make changes in Apache's configuration. So you have to ask your hosting administrator to enable mod_rewrite module for you. This is already enabled by almost every shared hosting provider.

温柔嚣张 2024-09-22 15:00:06

我遇到了这个问题,但重写模块已经启用。商店 .htaccess 文件中有一个标头命令导致了该问题。在 apache 中启用 headers_module 修复了它。认为这可能对某人有帮助。

I had this problem but the rewrite module was already enabled. There is a header command in the shops .htaccess file that was causing it. Enabling the headers_module in apache fixed it. Thought this might help someone.

只是在用心讲痛 2024-09-22 15:00:06

这是 mod_rewrite 问题,只需在您的 apache 服务器中启用 mod_rewrite 或告诉您的网站托管公司为您启用它。这将使您的网站正常运行。

This is mod_rewrite problem, just enable mod_rewrite in your apache server or tell your website hosting company to enable it for you. This will make your site work.

清风疏影 2024-09-22 15:00:06

虽然每个人都说同样的,但我想根据我从这个 网站

如果您的服务器的 apache mod_rewrite 功能没有启用,就会发生这种错误。默认情况下,WAMP 服务器不加载此 Apache Mod Rewrite 模块。默认情况下它是禁用的。您必须启用此选项才能加载此模块。 WAMP Apache 配置文件中有关于此的行,但默认情况下已注释。要启用此 mod_rewrite 功能,请遵循此说明。

  • 查看系统托盘通知区域中的 Wamp 图标(靠近打卡时间)
    Windows 操作系统)
  • 单击 WAMP 图标
  • 转至 Apache>httpd.config
  • 配置文件将在“记事本”或默认文本中打开
    编辑。
  • 搜索文本“mod_rewrite”,你会发现一行
    “#LoadModule rewrite_modulemodules/mod_rewrite.so“
  • 通过从行开头删除哈希“#”来取消注释此行。
  • 保存文件通过单击“重新启动所有服务”重新启动 WAMP 服务器
    WAMP 菜单。你完成了!

Although everyone says the same, I want to add the answer based on some information I collected from this site.

This kind of error is happened if apache mod_rewrite feature of your server is not enabled. By default WAMP server does not load this Apache Mod Rewrite module. It is disabled by default. You have to enable a this option to load this module. There is line in WAMP Apache configuration file about this but that is commented by default. To enable this mod_rewrite feature follow this instruction.

  • Look at Wamp icon in notification area on system tray (near Clock in
    Windows OS)
  • Click on the WAMP icon
  • Go to Apache>httpd.config
  • A Configuration file will be opened in “Note Pad” or your default text
    editor.
  • Search the text “mod_rewrite” , you will find a line
    “#LoadModule rewrite_module modules/mod_rewrite.so“
  • Uncomment this line by removing the Hash “#” from the beginning of the line.
  • Save the file Restart WAMP Server by clicking “Restart All Services” from
    WAMP menu. YOU ARE DONE!
用心笑 2024-09-22 15:00:06

对于发现此问题的任何人,并且 mod_rewrite 已启用...

检查 WAMP 是否未将不需要的 .htaccess 文件放入 C:\ 驱动器的根目录中。

我想在尝试了 httpd.conf 文件中的不同设置之后,这发生在我身上。

恢复 httpd.conf 设置后,我开始看到内部服务器错误。删除 .htaccess 文件解决了该问题。

For anyone finding this question, and mod_rewrite is ALREADY enabled...

Check that WAMP hasn't put an unwanted .htaccess file in the root of the C:\ drive.

This happened to me, I think after experimenting with different settings in the httpd.conf file.

After I'd reverted my httpd.conf settings I started seeing the Internal Server Error. Deleting the .htaccess file fixed the problem.

花桑 2024-09-22 15:00:06

一定要先按照 hunzaboy 的建议去做。然后,如果您仍然收到错误,我发现我的 httpd-vhosts.conf 文件中的指令之一导致即使在听取了他的建议后仍然存在相同的错误。我评论了这一行:“要求全部授予”(使用较新版本的 Apache 可以正常工作),一切都很好。

Definitely do what hunzaboy suggests first. Then if you're still getting the error, I found that one of my directives in my httpd-vhosts.conf file was causing the same error to persist even after taking his advice. I commented the line: "Require all granted" (which worked using a newer version of Apache) and everything was fine.

聽兲甴掵 2024-09-22 15:00:06

必须在以下位置对此进行评论:
LoadModule rewrite_module 模块/mod_rewrite.so

this must be commented in:
LoadModule rewrite_module modules/mod_rewrite.so

哭了丶谁疼 2024-09-22 15:00:06

如果您发现 mod_rewrite 已取消注释,但仍然出现相同的错误。去检查headers_module是否启用。为此,您可以按照以下步骤操作。

  1. 左键单击通知区域中的 wamp 图标。
  2. 将鼠标悬停在 Apache
  3. 将鼠标悬停在 Apache 模块
  4. 单击 headers_module

现在等待 wamp 服务器重新启动并检查其是否正常工作。

If you find mod_rewrite already uncommented and still you get the same error. Go and check if the headers_module is enabled or not. For that you can follow below steps.

  1. Left click on wamp icon in the notification area.
  2. Hover to Apache
  3. Hover to Apache Modules
  4. Click on headers_module

Now wait for wamp server to restart and check If it works.

诗化ㄋ丶相逢 2024-09-22 15:00:06

我遇到了同样的问题,但问题并不在我的所有网站上,而仅在一个网站上。

因此,只需确保您的 .htaccess 文件中没有以下代码:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
Header always set Content-Security-Policy "upgrade-insecure-requests;"

I had same issue, but the problem wasn't on all my websites, it was only on one.

So just make sure you don't have following code in your .htaccess file:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
Header always set Content-Security-Policy "upgrade-insecure-requests;"
云归处 2024-09-22 15:00:06

@MikMark我刚刚找到了我已经遇到过这个问题的解决方案。我还有 module/mod_rewrite.so 文件未注释。所以我找到了以下解决方案。

  • 转到 \wamp\bin\apache\apache2.4.54.2\conf\httpd.conf
  • 搜索 rewrite_module module/mod_rewrite.so
  • 注释此行并添加前缀 '#'

这可能对您有帮助。

@MikMark I just found solution which I have already faced this problem. I also have modules/mod_rewrite.so file is uncommented. So I found below solution.

  • Go to \wamp\bin\apache\apache2.4.54.2\conf\httpd.conf
  • Search for a rewrite_module modules/mod_rewrite.so
  • Comment this line with prefix '#'

This might be helpful for you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文