我只是在CentOS 5.5 x64 LAMP VPS上将我的网站内容从Plesk迁移到了Cpanel。 我遇到的问题是一些PHP文件的工作 – 其他人不。 例如,当前的index.php文件正在查找并运行phpinfo()并给出结果 – 如果我创build了一个新的test.php文件,并从index.php中复制并粘贴完全相同的代码,则会生成一个“内部服务器错误“消息。
任何人都可以提供这方面的协助吗? 这发生在所有我的域名,在一个情况下,没有PHP文件正在工作。
所有的标准.html文件工作,导致相信我的PHP安装有问题?
从日志中提取2个例子如下:
日志的几个摘录 – “[Thu Oct 21 20:03:45 2010] [error] [client hidden ] Application.cpp中的SoftException:363:脚本”/ home / hidden /public_html/test.php“的GID是小于min_gid [Thu Oct 21 20:03:45 2010] [错误] [客户端隐藏 ]脚本头文件过早结束:test.php“
“[Thu Oct 21 20:05:46 2010] [error] [client 80.255.223.242] Application.cpp中的SoftException:431:文件”/ home / trades / public_html“的目标GID(507)和GID(10)之间不匹配/index.php“[2010年10月21日20:05:46 2010年] [错误] [客户端80.255.223.242]脚本头过早结束:index.php”
我很确定这将是一个suphp错误。 检查工作文件和错误文件之间的所有权差异,其中将有启发。
/home/trades/public_html/index.php与预期的不同。 检查/ etc / group中的预期组
cat /etc/group | grep 507 | awk -F":" {'print $1'}
并运行
chgrp correct-group-name /home/trades/public_html/index.php
然后确保该文件和public_html下的其他人的权限不高于755和所有者/组
听起来你的新服务器使用suPHP,而你的旧服务器没有。 而且,你的权限和/或所有权一直很渺茫。 这是一个方便的小脚本来解决它。 这个特定的代码是我的头顶,所以我没有testing它。 随意作出更正。 但是理论是正确的:我在客户端服务器上经常使用类似这样的东西。
将其保存为脚本,使其可执行,并传入要修复的用户名。
#!/bin/bash die() { echo $* >&2; exit 1; } USER=$1 # sanity checks [[ -z $USER ]] && die "Please supply a user name" [[ -d /home/$USER/public_html/ ]] || die "Username is not found" [[ -d /home/$USER/tmp/ ]] || die "tmp dir not found... are you sure this is cpanel?" G=$(stat --format=%G /home/$USER/public_html/) [[ $G == "nobody" ]] || die "public_html not owned by group nobody? WTF?" #change ownership of stuff chown -R --reference=/home/$USER/tmp /home/$USER/public_html chgrp nobody /home/$USER/public_html #remove o/g write permission chmod -R go-w /home/$USER/public_html echo "You're all set, boss"
我解决了同样的问题,只要注意两点:
疑难解答指南: http : //www.thecpaneladmin.com/tag/troubleshooting/
你需要find一种方法来查看出现的PHP错误。 他们正在被logging?
一种技术是尝试在命令行上运行脚本,然后可能会打印php错误。
php -f <filename>
另一种方法是编辑test.php并更改错误logging设置,例如打开打印错误或将错误logging到/ tmp /
这些可能是非常令人沮丧的解决,但一旦你在看什么PHP错误是应该从那里stream动。 您的.htaccess或Apacheconfiguration可能会解释为什么index.php与test.php的处理方式不同。