PHP文件中的500内部服务器错误

时间:2015-07-04 15:15:48

标签: php apache error-handling

我有问题。我在我的VPS服务器上安装了CentOS Web Panel和清漆缓存。我有两个域,一个VPS上的两个主机。一个网站正在使用WordPress其他不是。现在非wordpress网站上的所有内容都正常工作(html,js,css,图片文件...),除了PHP文件现在不能正常工作(WordPress上相同)。只有一个文件名为testmail.php,其中包含:<?php echo phpinfo(); ?> 这是apache错误日志:

[Sat Jul 04 16:29:29 2015] [error] [client 172.***.***.***] Premature end of script headers: testip.php
[Sat Jul 04 16:29:37 2015] [notice] caught SIGTERM, shutting down
[Sat Jul 04 16:29:39 2015] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sat Jul 04 16:29:39 2015] [notice] suEXEC mechanism enabled (wrapper: /usr/local/apache/bin/suexec)
[Sat Jul 04 16:29:40 2015] [notice] Apache/2.2.27 (Unix) mod_ssl/2.2.27 OpenSSL/1.0.1e-fips configured -- resuming normal operations
[Sat Jul 04 16:42:07 2015] [notice] caught SIGTERM, shutting down
[Sat Jul 04 16:42:21 2015] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sat Jul 04 16:42:21 2015] [notice] suEXEC mechanism enabled (wrapper: /usr/local/apache/bin/suexec)
[Sat Jul 04 16:42:22 2015] [notice] Apache/2.2.27 (Unix) mod_ssl/2.2.27 OpenSSL/1.0.1e-fips configured -- resuming normal operations

我注意到我有两个php.ini个文件,一个位于/etc/php.ini,另一个位于/usr/local/php/php.ini(由服务器使用),我还有两个httpd.conf个文件位于/etc/httpd/conf/httpd.conf的其他位于/usr/local/apache/conf/httpd.conf(由服务器使用)。我还注意到第二个apache配置文件(由服务器使用)中没有模块(mod_rewrite.so ..或任何其他模块)。

我尝试更改所有权(chown)并尝试更改文件权限(chmod)但没有任何作用。你能帮忙吗?

1 个答案:

答案 0 :(得分:0)

500内部服务器错误由于以下原因发生。你可以通过以下方式解决: - 1.如果您没有给文件留下权限,您可能会收到此错误。请给予文件许可。

  1. 或打开Apache的httpd.conf文件 你必须找到以下行,并删除#

    LoadModule rewrite_module modules / mod_rewrite.so

  2. LoadModule headers_module modules / mod_headers.so

    1. 您还可以检查您的htaccess文件或文件夹是否允许。