500 内部服务器错误取决于外部加载的文件?

500 Internal Server Error depending on external loaded files?

我遇到 500 Internal Server Error 并且很可能认为加载外部文件是我的问题。 在我的状态栏中,在此之前我收到了消息 Waiting for available sockets...

我在谷歌搜索时发现了这个信息:

PHP CODING TIMING OUT

If your PHP script makes external network connections, the connections may time out. If too many connections are attempted and time out, this will cause a "500 Internal Server Error." To prevent these time outs and errors, you'll want to make sure that PHP scripts be coded with some timeout rules. Typically, however, catching a timeout error when connecting to a database or externally to remote resources (example: RSS feeds) are difficult. They, in effect, freeze the script from continuing to run.

Removing any external connections can increase both the performance of your website and decrease the chances of you receiving a "500 Internal Server Error."

1) 我动态 generate/load css 和来自我的网络服务器的 js 文件(*.php 文件)。所以我不知道现代浏览器是否真的缓存了这个或者根本不能缓存这个并且在每次页面加载时将它作为一个新请求来处理?因为 PHP 根据给定的参数生成此参数,以告知应加载哪个 css/js。这甚至是可能导致此 500 内部服务器错误的问题吗?

2) 您可以推荐什么 Chrome 扩展来跟踪和调试所有网络数据?除了 Chrome DevTools 之外,一般有哪些工具可以帮助我?

3) 引用的文字说我必须处理超时问题。我应该检查哪些重要来源? ajax 个请求或 php 个会话可能是问题所在吗?

4) 最重要的是:我该如何修复这个错误?如果这有助于提及,可以在 www.vaymodels.com 导航域。我无法使用任何浏览器打开它,甚至无法使用我的智能手机(已禁用 WiFi)打开它。也许你们中有人可以打开它并查看页面源代码。

另外值得一提的是,这种行为最近几天才刚刚开始。当我在我的网站上工作时,我不断上传文件并多次刷新域,并且随机地它在 5-10 分钟内根本没有加载。但是之后可以在没有500错误的情况下到达。现在好像无法访问了。

编辑:我的网站托管商刚刚告诉我他们将我的 FPM 限制从 15 更新到 30。他说 php 进程太多了。这可能是由于 mysql 我正在通过通过 cronjob 加载的文件执行的查询引起的,或者我应该寻找的那些进程最有可能是什么问题?

您应该先了解是什么脚本导致了500错误。您可以查看错误日志或在可疑脚本的顶部添加:

ini_set("display_errors",1);
error_reporting(E_ALL);

这应该可以帮助您了解问题出在哪里,但也可能会中断输出,因此如果您在生产环境中使用它,请务必小心。

关于 js 和 css 资源的缓存:您可以使用 the.htaccess 文件中的一些指令指示 apache 告诉浏览器使用文件的缓存副本,例如:

<IfModule mod_expires.c>
ExpiresActive on
ExpiresByType text/css                  "access plus 1 month"
ExpiresByType application/javascript    "access plus 1 month"
ExpiresByType text/javascript           "access plus 1 month"

<IfModule mod_headers.c>
Header append Cache-Control "public"
</IfModule>

</IfModule>

另请记住,此类过期限制在您不应该经常更改它们的生产环境中可能很好。

希望对您有所帮助。