为什么我的某些页面在 XAMPP 服务器上返回 500?

发布于 2024-09-28 01:38:52 字数 997 浏览 3 评论 0原文

我无法弄清楚我的生活到底发生了什么。

通常,当我想在本地运行站点以进行测试时,我只需将浏览器指向:

http://localhost/site_folder

这适用于我的大多数页面,但由于一些奇怪(我的意思是非常奇怪)的原因,某些文件夹给出了 500 重定向错误。

我认为我的一个脚本可能出了问题,直到我创建了一个新文件夹和一个基本的 php 信息页面:

<?php
phpinfo();
?>

我的网站出现了:

内部服务器错误

服务器遇到内部问题 错误或配置错误,并且是 无法完成您的请求。

请联系服务器 管理员,postmaster@localhost 并告知他们错误发生的时间 发生了,以及你可能遇到的任何事情 这样做可能会导致错误。

有关此错误的更多信息可能会 可在服务器错误日志中找到。

此外,还有一个 500 内部服务器 遇到错误错误 尝试使用 ErrorDocument 来 处理请求。

Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1 服务器位于 本地主机端口80

我检查本地错误日志并得到:

由于可能的配置错误,请求超出了 10 个内部重定向的限制。如有必要,请使用“LimitInternalRecursion”增加限制。使用“LogLevel debug”获取回溯。

我的配置没有任何变化,没有 .htaccess 文件可乱,其他文件夹可以工作。这是怎么回事?

I cannot figure out what the hell is going on for the life of me.

Normally when I want to run a site locally for testing purposes, I simply point my browser to:

http://localhost/site_folder

This works on the majority of my pages but for some strange (and I mean really strange) reason, some folders give a 500 redirect error.

I thought perhaps something was wrong with one of my scripts until I created a new folder and a basic php info page:

<?php
phpinfo();
?>

my site comes up with:

Internal Server Error

The server encountered an internal
error or misconfiguration and was
unable to complete your request.

Please contact the server
administrator, postmaster@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.

Additionally, a 500 Internal Server
Error error was encountered while
trying to use an ErrorDocument to
handle the request.

Apache/2.2.14 (Win32) DAV/2
mod_ssl/2.2.14 OpenSSL/0.9.8l
mod_autoindex_color PHP/5.3.1
mod_apreq2-20090110/2.7.1
mod_perl/2.0.4 Perl/v5.10.1 Server at
localhost Port 80

I check my local error logs and get:

Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

Nothing has changed on my configuration, no .htaccess files to mess with, other folders work. WTF is going on?

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

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

发布评论

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

评论(3

︶葆Ⅱㄣ 2024-10-05 01:38:52

我以前处理过这个问题,这是隐藏的 .htaccess 文件的结果,我知道你说过你已经检查过一个文件,但可能会尝试检查你的 htdocs 文件夹,因为如果你的 documentroot 在你的 httpd.conf 中设置为 /htdocs 那么其中的任何文件夹都将继承您的 .htaccess 设置。

情况可能并非如此,但无论如何还是值得检查一下。

I have dealt with this problem before and it was the result of a hidden .htaccess file, I know you said you have checked for one but possibly try checking your htdocs folder because if you documentroot is set to /htdocs in your httpd.conf then any folders inside that will inherit your .htaccess setup.

It's probably not the case but just worth giving it a check anyway.

南七夏 2024-10-05 01:38:52

根据我的个人经验,我发现 XAMPP 是一个糟糕的软件。我总是从头开始构建我的环境,它并不像人们想象的那么难。使用其他人的设置(例如 XAMPP)来诊断错误非常困难。

这很可能就是您的重定向问题的根源。我会检查所有 php,记录任何重定向,并远离 XAMPP 运行的任何代码(禁用它附带的任何页面)。

希望这会有所帮助,但我最后的建议是摆脱它=)

In my personal experience i find that XAMPP is awful piece of software. I always build my environment from scratch, its not as hard as people think. Its very difficult to diagnose errors with somebody else's setup such as XAMPP.

Most likely this is where your redirect issue comes from. I would check all php keeping note of any redirects and stay away from any code that is run by XAMPP (disabling any pages that come with it).

Hopefully this should help, but my final advice is get rid of it =)

佼人 2024-10-05 01:38:52

也许现在回答已经太晚了,但发生在我身上的错误是以下

Rewrite Engine On
RewriteCond % { REQUEST_FILENAME }! -f
RewriteRule ^ ([ ^ \.] + ) $ $1.php[NC, L]
RewriteRule ^ ([ ^ \.] + ) $ $1.html[NC, L]

ErrorDocument 404 http://pagina.com/404
    Error Document 500 http://pagina.com/404

.htaccess 配置错误,使用 VS 它会抛出我它用空格包装文件
只需删除测试中的 .htaccess 并在生产中放置它

maybe it's too late to answer but the error that happened to me was the following

Rewrite Engine On
RewriteCond % { REQUEST_FILENAME }! -f
RewriteRule ^ ([ ^ \.] + ) $ $1.php[NC, L]
RewriteRule ^ ([ ^ \.] + ) $ $1.html[NC, L]

ErrorDocument 404 http://pagina.com/404
    Error Document 500 http://pagina.com/404

The .htaccess was misconfigured, using VS it throws me it wraps the file with spaces
Just remove the .htaccess in test and in production you put it

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