无法让php exec正常工作 [英] Cant get php exec to work

查看:78
本文介绍了无法让php exec正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为此战斗了几个小时,但似乎无法解决. 尝试了exec(),shell_exec()和system().什么都行不通. 我有这个:

I've been fighting with this for a few hours now, and I can't seem to work it out. tried exec(), shell_exec(), and system(). Nothing works. I have this:

exec("/usr/bin/php /var/www/vhosts/domain.com/httpdocs/shell/send.php >> /var/www/vhosts/domain.com/httpdocs/shell/paging.log &");

send.php仅具有:

send.php simply has:

echo 'works';

但是日志中什么也没有显示.我已经在这里搜索并阅读了一些东西,但找不到任何帮助.

But nothing shows up in the log. I've googled and read stuff on here, but I can't find anything to help.

我正在运行php v.5.3.8. 安全模式已开启 我很确定这是php的路径,但无法真正找到如何找到它,因此我将继续使用phpinfo().

I'm running php v.5.3.8. safe mode is on I'm pretty sure that is the path to php, but can't really find out how to find it, so I'm going on phpinfo().

exec('whoami');什么也没做.是否应该在浏览器中显示?或给您发电子邮件? 有什么想法吗?

exec('whoami'); does nothing. Is it suppose to show in the browser? or email you something? any ideas?

推荐答案

根据exec函数的PHP手册:

According to PHP Manual for exec function:

启用安全模式后,您只能在 safe_mode_exec_dir.出于实际原因,目前不允许 在可执行文件的路径中具有..组件.

When safe mode is enabled, you can only execute files within the safe_mode_exec_dir. For practical reasons, it is currently not allowed to have .. components in the path to the executable.

检查 http://php.net/manual/en/ini.sect.safe-mode.php#ini.safe-mode-exec-dir

另外,请注意,Web服务器用户必须具有写入日志文件的权限.

Also, be aware that the web server user must have permission to write in the log file.

关闭安全模式,不仅要检查 php.ini 文件,还要检查Web服务器中虚拟主机的特定配置,无论是Apache,NginX还是其他.如果使用Plesk,请在虚拟主机中查找httpd.include,并确保将safe_mode也设置为off.

To turn safe mode off, check not only php.ini file but also virtual hosts specific configurations in your web server, whether it is Apache, NginX or other. If you use Plesk, look in vhosts for httpd.include, and make sure that safe_mode is set to off there as well.

这篇关于无法让php exec正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆