php 文件的 500 内部服务器错误而不是 html [英] 500 Internal Server Error for php file not for html

查看:33
本文介绍了php 文件的 500 内部服务器错误而不是 html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站只有 4-5 个静态页面.index.html &index.php 都在那里.index.html 工作正常.如果我更改为 index.php,它会给出 500 Internal Server Error.我不知道我的错误在哪里?

My site having 4-5 static pages only. index.html & index.php both are there. index.html is working fine. If I change to index.php, it's giving 500 Internal Server Error. I don't know where is my mistake?

注意:如果我使用带有 php_flag display_errors 1.htaccess 文件,

Note: If I use .htaccess file with php_flag display_errors 1,

显示 此外,在尝试使用 ErrorDocument 处理请求时遇到 500 Internal Server Error 错误.

如果我使用 empty.htaccess 文件,

If I use .htaccess file with empty,

显示 此外,在尝试使用 ErrorDocument 处理请求时遇到 404 Not Found 错误.

如果我给 ../contact-us.php,它显示正确.

And if I give ../contact-us.php, it's showing correctly.

谢谢...

推荐答案

如果您的 php 代码有致命错误但错误显示已关闭,则会显示 500 Internal Server Error.你可以试试这个来查看错误本身而不是 500 错误页面:

500 Internal Server Error is shown if your php code has fatal errors but error displaying is switched off. You may try this to see the error itself instead of 500 error page:

在您的 php 文件中:

ini_set('display_errors', 1);

在 .htaccess 文件中:

php_flag display_errors 1

这篇关于php 文件的 500 内部服务器错误而不是 html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆