如何从shell_exec执行另一个PHP脚本

时间:2018-06-04 19:08:40

标签: php shell-exec

我第一次尝试从shell_exec执行脚本,我不知道我的问题来自命令或路径。 从我接下来的几个教程中我按照指示打印出phpinfo(),看到bin path,这就是我在输出$_ENV['PATH'] /usr/local/bin:/usr/bin:/bin中得到的。我尝试使用下面的脚本,但没有运气可以帮助我。

我的文件看起来像这样

public_html / dir / exec_test.php为http://example.com/dir/exec_test.php

<?php 
 echo 'Script succeeded';
?>

public_html / dir / exec.php为http://example.com/dir/exec.php

<?php 
$postid = 3;
shell_exec("/usr/local/bin:/usr/bin:/bin /home/uhs67388/public_html/dir/exec_test.php '".$postid."' 'alert' >> /home/uhs67388/public_html/alert_log/paging.log &");
//shell_exec("/usr/local/bin:/usr/bin:/bin ".__DIR__."/exec_test.php '".$postid."' 'alert' >> ".__DIR__."/../alert_log/paging.log &");
?>

0 个答案:

没有答案
相关问题