无法在控制台中运行PHP文件

时间:2012-10-31 02:45:30

标签: php

使用命令:

$output = shell_exec("/usr/bin/php /path/to/my/file.php");
echo $output;

获得此结果:

    string(1208) "Content-type: text/html string(1165) "Content-type: text/html string(1122) "Content-type: text/html string(1079) "Content-type: text/html string(1036) "Content-type: text/html string(994) "Content-type: text/html string(952) "Content-type: text/html string(910) "Content-type: text/html string(868) "Content-type: text/html string(826) "Content-type: text/html string(784) "Content-type: text/html string(742) "Content-type: text/html string(700) "Content-type: text/html string(658) "Content-type: text/html string(616) "Content-type: text/html string(574) "Content-type: text/html string(532) "Content-type: text/html string(490) "Content-type: text/html string(448) "Content-type: text/html string(406) "Content-type: text/html string(364) "Content-type: text/html string(322) "Content-type: text/html string(280) "Content-type: text/html
Warning: shell_exec() [function.shell-exec]: Unable to execute '/usr/bin/php /home/zumblemo/public_html/ad/../test.php' in /home/zumblemo/public_html/ad/test.php on line 5
bool(false) " " " " " " " " " " " " " "

现在应该只输出“测试”一词 我不明白。 当我启动像这样的Python文件时,它可以工作。
托管支持说同样适用于PHP文件。

路径100%正确(当它们不正确时 - 它只是给出NULL结果)

PS: 大! php-cli工作。 谢谢!

1 个答案:

答案 0 :(得分:0)

看起来你的脚本递归调用自己,直到达到递归限制。它看起来像php可能是php-cgi的符号链接。尝试改为调用php-cli。