![PHP 问题 - 500 内部服务器错误(全新服务器)](https://linux22.com/image/547293/PHP%20%E9%97%AE%E9%A2%98%20-%20500%20%E5%86%85%E9%83%A8%E6%9C%8D%E5%8A%A1%E5%99%A8%E9%94%99%E8%AF%AF%EF%BC%88%E5%85%A8%E6%96%B0%E6%9C%8D%E5%8A%A1%E5%99%A8%EF%BC%89.png)
有人见过这些错误或者类似的错误吗?
/usr/bin/php: error while loading shared libraries: libcom_err.so.2: failed to map segment from shared object: Cannot allocate memory
[warn] UID of script "/usr/local/apache/htdocs/index.PHP" is smaller than min_uid
[info] Executing "/home/mysite/public_html/index.php" as UID 501, GID 501
我真的不确定该如何修复,但我认为我的 WHM/Cpanel 中的一些内存设置不正确?
- - 更新:
使用下面答案中所述的命令,这是我在加载用户索引页时看到的内容(我屏蔽了服务器的 IP 和用户名):
==> /usr/local/apache/logs/error_log <==
[Sat Apr 23 17:37:18 2011] [error] [client IPADDRESS] /usr/bin/php: error while loading shared libraries: libcom_err.so.2: failed to map segment from shared object: Cannot allocate memory
[Sat Apr 23 17:37:18 2011] [error] [client IPADDRESS] Premature end of script headers: index.php
[Sat Apr 23 17:37:18 2011] [error] [client IPADDRESS] File does not exist: /home/username/public_html/500.shtml
==> /usr/local/apache/logs/suphp_log <==
[Sat Apr 23 17:37:18 2011] [info] Executing "/home/username/public_html/index.php" as UID 501, GID 501
此外,当我直接转到我的 IP 地址(我刚刚在 index.php 内将一个简单的 PHP 重定向到我的域名...)时,我收到以下错误:
==> /usr/local/apache/logs/access_log <==
IPADDRESS - - [23/Apr/2011:17:40:58 -0400] "GET /index.PHP HTTP/1.1" 404 -
==> /usr/local/apache/logs/error_log <==
[Sat Apr 23 17:40:58 2011] [error] [client IPADDRESS] SoftException in Application.cpp:357: UID of script "/usr/local/apache/htdocs/index.PHP" is smaller than min_uid
[Sat Apr 23 17:40:58 2011] [error] [client IPADDRESS] Premature end of script headers: index.PHP
[Sat Apr 23 17:40:58 2011] [error] [client IPADDRESS] File does not exist: /usr/local/apache/htdocs/500.shtml
==> /usr/local/apache/logs/suphp_log <==
[Sat Apr 23 17:40:58 2011] [warn] UID of script "/usr/local/apache/htdocs/index.PHP" is smaller than min_uid
最后...这些是空的:
- modsec_audit.log
- modsec_debug_log
我在 suexec.log 中看到:
: uid: (501/username) gid: (501/username) cmd: redirect.cgi
以及更多如上所述的相同错误...
答案1
我正在寻找此问题的答案并找到了以下答案:
将文件的所有权设置为 nobody。即
chown nobody:nobody index.php
现在我没有收到错误。
答案2
希望您可能正在使用 Suphp 运行 Cpanel 服务器。从错误来看,这似乎是权限/所有权问题,表明 PHP 文件的所有者调用不正确,或者权限高于 suphp.conf 中允许的权限。
您可以检查日志以获取错误的更多详细信息:
tail -fvn0 /usr/local/apache/logs/*log