PHP:使用 WAMP 时出现内部服务器错误(启动时)
我遇到了 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
这是由于
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!这是因为 mod_rewrite 模块在 Apache 的配置中被禁用:
如果您的网站托管在本地计算机上,您只需打开 Apache 的 conf 文件夹中的 httpd.conf 并搜索“mod_rewrite”即可。如果 mod_rewrite 行前面有一个 #,只需删除此 #,保存文件,然后重新启动 Apache。
如果您的网站托管在共享托管服务器上,那么您可能无权更改 Apache 的配置。因此,您必须要求您的托管管理员为您启用 mod_rewrite 模块。几乎每个共享托管提供商都已启用此功能。
This is because mod_rewrite module is disabled in your Apache's configuration:
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.
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.
我遇到了这个问题,但重写模块已经启用。商店 .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.
这是 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.
虽然每个人都说同样的,但我想根据我从这个 网站。
如果您的服务器的 apache mod_rewrite 功能没有启用,就会发生这种错误。默认情况下,WAMP 服务器不加载此 Apache Mod Rewrite 模块。默认情况下它是禁用的。您必须启用此选项才能加载此模块。 WAMP Apache 配置文件中有关于此的行,但默认情况下已注释。要启用此 mod_rewrite 功能,请遵循此说明。
Windows 操作系统)
编辑。
“#LoadModule rewrite_modulemodules/mod_rewrite.so“
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.
Windows OS)
editor.
“#LoadModule rewrite_module modules/mod_rewrite.so“
WAMP menu. YOU ARE DONE!
对于发现此问题的任何人,并且 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.
一定要先按照 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.
必须在以下位置对此进行评论:
LoadModule rewrite_module 模块/mod_rewrite.so
this must be commented in:
LoadModule rewrite_module modules/mod_rewrite.so
如果您发现
mod_rewrite
已取消注释,但仍然出现相同的错误。去检查headers_module
是否启用。为此,您可以按照以下步骤操作。Apache
Apache 模块
headers_module
现在等待 wamp 服务器重新启动并检查其是否正常工作。
If you find
mod_rewrite
already uncommented and still you get the same error. Go and check if theheaders_module
is enabled or not. For that you can follow below steps.Apache
Apache Modules
headers_module
Now wait for wamp server to restart and check If it works.
我遇到了同样的问题,但问题并不在我的所有网站上,而仅在一个网站上。
因此,只需确保您的
.htaccess
文件中没有以下代码: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:@MikMark我刚刚找到了我已经遇到过这个问题的解决方案。我还有 module/mod_rewrite.so 文件未注释。所以我找到了以下解决方案。
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.
rewrite_module modules/mod_rewrite.so
'#'
This might be helpful for you.