php Apache 服务器抛出 500 内部服务器错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23223289/
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
Apache Server Throwing 500 Internal Server Error
提问by CodeTalk
I hada LAMP application running wordpress and I deleted the whole directory and replaced with new files - php based.
我有一个运行 wordpress 的 LAMP 应用程序,我删除了整个目录并替换为基于 php 的新文件。
Now, when I go to view my server running CentOS - it just shows a 500 Internal Server error.
现在,当我查看运行 CentOS 的服务器时 - 它只显示 500 Internal Server 错误。
I've tried:
我试过了:
- restarting server
- restarting apache service itself
- 重启服务器
- 重新启动apache服务本身
both completed successfully, but this didn't fix anything. Now, I do not know where to go from here.
两者都成功完成,但这并没有解决任何问题。现在,我不知道从哪里开始。
apache logs @ /usr/local/apache/logs/error_log
on apache:
apache logs @ /usr/local/apache/logs/error_log
在阿帕奇:
[Tue Apr 22 11:12:15 2014] [error] [] SoftException in Application.cpp:357: UID of script "index.php" is smaller than min_uid
回答by CodeTalk
I found the fix myself, this wasn't an error with Mysql at all, but rather a permissions issue with the index.php file I had.
我自己找到了修复程序,这根本不是 Mysql 的错误,而是我拥有的 index.php 文件的权限问题。
The error, which I found in /usr/local/apache/logs/error_log
was:
:is smaller than min_uid Premature end of script headers: index.php
我发现的错误/usr/local/apache/logs/error_log
是::小于 min_uid 脚本头的过早结束:index.php
To fix, I did this:
为了解决这个问题,我这样做了:
ls -l
in the directory causing the issue (mine waspublic_html
)- You should see the index file (e.g. index.php) that should be causing the issue. It is due to a
root
user having the only permission to the file and not your CPanel (or system) username. (note this system/cpanel name) Run the following within the errorneous directory(Note: this command must be run within all subdirectories of the primary errorneous directory.):
sudo chown yoursystemuserhere:yoursystemgroupuserhere index.php
or to apply to the whole directory (thanks to @Prix):
sudo chown -R user:group /folder
You're all set.
ls -l
在导致问题的目录中(我的是public_html
)- 您应该会看到应该导致问题的索引文件(例如 index.php)。这是由于
root
用户拥有该文件的唯一权限,而不是您的 CPanel(或系统)用户名。(注意这个系统/面板名称) 在错误目录中运行以下命令(注意:此命令必须在主要错误目录的所有子目录中运行。):
sudo chown yoursystemuserhere:yoursystemgroupuserhere index.php
或应用于整个目录(感谢@Prix):
sudo chown -R user:group /folder
你都准备好了。
Further literature here: http://www.inmotionhosting.com/support/website/general-server-setup/uid-smaller-than-min-uid
更多文献:http: //www.inmotionhosting.com/support/website/general-server-setup/uid-smaller-than-min-uid
I hope this helps someone else in the future.
我希望这会在将来对其他人有所帮助。
回答by jamsandwich
I had similar symptoms on my cPanel VPS - I was able to use easyApache to recompile Apache and PHPwhich fixed the problem for me.
我在我的 cPanel VPS 上有类似的症状 - 我能够使用 easyApache 重新编译 Apache 和 PHP,这为我解决了这个问题。
(I realise my problem was slightly different to yours, but it may be helpful for people in the future who have the same problem I had).
(我意识到我的问题与您的略有不同,但它可能对将来遇到同样问题的人有所帮助)。
回答by Chiamaka Ikeanyi
chown -R user.usergroup /path_to_the_directory
Will resolve this. It is basically permission issues.
会解决这个问题。这基本上是权限问题。
回答by Mayank Sinha
just install wordpress latest version make sure you have atleast php version 5.3 and above also look global register variable if it off or just delete htacess file from server and see what will happens generally 500 internal server gives when file permission is missing so you should delete htacess file
只需安装 wordpress 最新版本 确保您至少有 php 5.3 及更高版本 如果关闭或只是从服务器删除 htacess 文件,请查看全局寄存器变量,看看通常会发生什么 500 内部服务器在缺少文件权限时给出,因此您应该删除 htacess文件