php shell_exec不';在浏览器中不工作,但在终端中工作

php shell_exec不';在浏览器中不工作,但在终端中工作,php,shell-exec,Php,Shell Exec,我正在开发shell_exec,它不是在浏览器中运行,而是在终端中运行。这是我的密码: <?php echo 1; shell_exec ("gpg --output /home/datafeeding/testing/sampledick.xls.gpg --encrypt --recipient rtalplacido@yahoo.com /opt/jasperserver-3.5.0/apache-tomcat/webapps/JavaBridge/reports/

我正在开发shell_exec,它不是在浏览器中运行,而是在终端中运行。这是我的密码:

<?php
    echo 1;

    shell_exec ("gpg --output /home/datafeeding/testing/sampledick.xls.gpg --encrypt --recipient rtalplacido@yahoo.com /opt/jasperserver-3.5.0/apache-tomcat/webapps/JavaBridge/reports/sampledick.xls");

    echo 2;
    echo "<br>";

?>

echo 2
,它只通过shell exec

注意:当PHP在安全模式下运行时,此函数被禁用

另外,在gpg二进制文件-/usr/bin/gpg中添加完整路径

请参阅此帖子:

注意:当PHP在安全模式下运行时,此函数被禁用

另外,在gpg二进制文件-/usr/bin/gpg中添加完整路径


请参阅本文:

好的,试试exec()-它有一个可以检查的return\u var变量。也许您必须向gpg二进制文件添加路径。只需使用pull path:
exec('/usr/bin/gpg--output/home/datafeed/testing/sampledick.xls.gpg--encrypt--recipientrtalplacido@yahoo.com/opt/jasperserver-3.5.0/apachetomcat/webapps/JavaBridge/reports/sampledick.xls',$output,$return);var_dump($output,$return)嗨!它输入数组(0){}int(2),它返回2,这意味着错误:“误用了shell内置项”——就像找不到gpg一样。尝试以下代码:
exec('$(哪个gpg)--输出/home/datafeed/testing/sampledick.xls.gpg--加密--收件人rtalplacido@yahoo.com/opt/jasperserver-3.5.0/apachetomcat/webapps/JavaBridge/reports/sampledick.xls',$output,$return);var_dump($output,$return)我已经更新了我的答案。您应该添加--yes,-always trust和--homedirook,try exec()-它具有可以检查的return\u var变量。也许您必须向gpg二进制文件添加路径。只需使用pull path:
exec('/usr/bin/gpg--output/home/datafeed/testing/sampledick.xls.gpg--encrypt--recipientrtalplacido@yahoo.com/opt/jasperserver-3.5.0/apachetomcat/webapps/JavaBridge/reports/sampledick.xls',$output,$return);var_dump($output,$return)嗨!它输入数组(0){}int(2),它返回2,这意味着错误:“误用了shell内置项”——就像找不到gpg一样。尝试以下代码:
exec('$(哪个gpg)--输出/home/datafeed/testing/sampledick.xls.gpg--加密--收件人rtalplacido@yahoo.com/opt/jasperserver-3.5.0/apachetomcat/webapps/JavaBridge/reports/sampledick.xls',$output,$return);var_dump($output,$return)我已经更新了我的答案。你应该加上——是的,——永远信任和——homedir