PHP 对外部程序的调用全部失败,退出代码为 127
echo system("/usr/bin/whoami", $ret);
echo $ret;
Apache 2.0.52、CentOS 4.5 上的 PHP 4.3.9。 安全模式已关闭,我可以从命令行以 apache 用户帐户运行程序,但从 PHP 运行的所有程序都会失败,退出代码为 127。
echo system("/usr/bin/whoami", $ret);
echo $ret;
PHP 4.3.9 on Apache 2.0.52, CentOS 4.5. Safe mode is off, I can run programs as the apache user account from the command line, but all programs run from PHP fail with exit code 127.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
/usr/bin/whoami
是否存在,并且任何人都可以执行(且可读,模式xx5
)。doc_root
和user_dir
上的php.ini
,如果设置了这些内容,它们可以限制您可以执行的内容。dmesg
或/var/log/
中的日志文件。&$ret
而不是$ret
。exec()
和passthru()
,不同的函数可能适用于不同的情况。php.ini
,对于 cli 使用也有一个不同的。/usr/bin/whoami
exists, and is executable (and readable, modexx5
) by anyone.php.ini
ondoc_root
anduser_dir
, if those are set they can limit what you can execute.dmesg
or log files in/var/log/
.&$ret
instead of$ret
.exec()
andpassthru()
, different functions might work for different situations.php.ini
for Apache, and a different one for cli use.