PHP:使用 WAMP 的内部服务器错误(启动时)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3540210/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PHP:Internal Server Error using WAMP (at startup)
提问by MikMark
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.
我在使用 php 时遇到问题。它显示如下错误。它在其他计算机上运行良好,但是当我尝试在另一台计算机上运行它时,它显示如下错误。我想我的 wampserver 2.0 配置有问题。
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.
内部服务器错误
服务器遇到内部错误或配置错误,无法完成您的请求。请联系服务器管理员 webmaster@localhost 并告知他们发生错误的时间,以及您可能执行的任何可能导致错误的操作。更多信息关于此错误可能在服务器错误日志中可用。
回答by Aslam
Its due to mod_rewrite
. WAMP
had commented this option by default.
其由于mod_rewrite
. WAMP
默认情况下已评论此选项。
You need to go to WAMP
icon in notification area, Apache, httpd.config
您需要转到WAMP
通知区域中的图标,Apache,httpd.config
search for mod_rewrite
, and uncomment it.
搜索mod_rewrite
,然后取消注释。
After that RESTART WAMP
AND YOU ARE DONE!
之后重新开始WAMP
,你就完成了!
回答by Ali
This is because mod_rewrite module is disabled in your Apache's configuration:
这是因为 Apache 的配置中禁用了 mod_rewrite 模块:
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.
如果您的网站托管在本地机器上,您只需在 Apaches 的 conf 文件夹中打开 httpd.conf 并搜索“mod_rewrite”。如果 mod_rewrite 行前面有一个 #,只需删除这个 #,保存文件,然后重新启动 Apache。
如果您的网站托管在共享托管服务器上,那么您可能无权更改 Apache 的配置。因此,您必须要求您的主机管理员为您启用 mod_rewrite 模块。几乎每个共享主机提供商都已启用此功能。
回答by classiqa
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.
这是 mod_rewrite 问题,只需在您的 apache 服务器中启用 mod_rewrite 或告诉您的网站托管公司为您启用它。这将使您的网站正常工作。
回答by Mani
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.
如果您的服务器的 apache mod_rewrite 功能未启用,则会发生这种错误。默认情况下,WAMP 服务器不会加载这个 Apache Mod Rewrite 模块。默认情况下它是禁用的。您必须启用此选项才能加载此模块。WAMP Apache 配置文件中有关于此的行,但默认情况下已注释。要启用此 mod_rewrite 功能,请遵循此说明。
- 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!
- 查看系统托盘通知区域中的 Wamp 图标(Windows 操作系统中的时钟附近)
- 单击 WAMP 图标
- 转到 Apache>httpd.config
- 配置文件将在“记事本”或您的默认文本编辑器中打开。
- 搜索文本“mod_rewrite”,你会发现一行“#LoadModule rewrite_module modules/mod_rewrite.so“
- 通过从行的开头删除哈希“#”来取消注释此行。
- 通过单击 WAMP 菜单中的“重新启动所有服务”保存文件重新启动 WAMP 服务器。你完成了!
回答by hawbsl
For anyone finding this question, and mod_rewrite is ALREADY enabled...
对于发现此问题的任何人,并且 mod_rewrite 已启用...
Check that WAMP hasn't put an unwanted .htaccess file in the root of the C:\ drive.
检查 WAMP 是否没有在 C:\ 驱动器的根目录中放置不需要的 .htaccess 文件。
This happened to me, I think after experimenting with different settings in the httpd.conf file.
这发生在我身上,我想在 httpd.conf 文件中尝试不同的设置之后。
After I'd reverted my httpd.conf settings I started seeing the Internal Server Error. Deleting the .htaccess file fixed the problem.
在我恢复我的 httpd.conf 设置后,我开始看到内部服务器错误。删除 .htaccess 文件解决了这个问题。
回答by user3052443
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.
我有这个问题,但重写模块已经启用。导致它的商店 .htaccess 文件中有一个标题命令。在 apache 中启用 headers_module 修复了它。认为这可能会帮助某人。
回答by Peter Brooks
Check the Wampserver log files, this issue is related to something in your Apache configuration.
检查 Wampserver 日志文件,此问题与 Apache 配置中的某些内容有关。
回答by John
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.
绝对先做 hunzaboy 的建议。然后,如果您仍然收到错误消息,我发现我的 httpd-vhosts.conf 文件中的一个指令导致相同的错误,即使在接受他的建议后仍然存在。我评论了这一行:“要求全部授予”(使用较新版本的 Apache),一切都很好。
回答by Kristian
this must be commented in: LoadModule rewrite_module modules/mod_rewrite.so
这必须在:LoadModule rewrite_module modules/mod_rewrite.so 中注释