php exec()返回空值 [英] php exec() returning empty value

查看:647
本文介绍了php exec()返回空值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我的目标是使用see PHP exec()的输出,但得到一个空值.我正在使用firephp(firebug扩展)日志记录,无法弄清为什么它是空的.

Currently my goal is to use see the output of PHP exec() but getting an empty value. Am using firephp (firebug extension) logging and can't figure out why it is empty.

完整代码在这里: https://github.com/MattMcFarland/ninja-forms-uploads-custom/blob/dev/uploads-custom.php

在这里形成表格: http://www.hvac-hacks.com/?page_id = 1383& preview = true& form_id = 96

            exec('mogrify -auto-orient -verbose -format jpg '.$dir."/".$user_file_name,$ouput);
            fb($output);
            curl_exec('mogrify -auto-orient -verbose -format jpg '.$dir."/".$user_file_name,$output);
            fb($output);
            $output = shell_exec('mogrify -auto-orient -verbose -format jpg '.$dir."/".$user_file_name);
            fb($output);

当前控制台显示我正在使用的每个exec方法为空.真的不知道该怎么办,完全不知所措.

Currently console shows empty for each exec method I'm using. Really not sure what to do, am at a complete loss.

控制台也可以正常工作,因为它显示了其他fb();内容. exec命令显示的空行前面带有数字3,表示空返回3次.

The console IS working as well, as it shows other fb(); stuff. The exec commands are showing an empty line with the number 3 in front of it, indicating empty return 3 times.

有什么想法吗?

推荐答案

问题是权限问题.不允许用户使用BASH.

Problem was a permissions issue. the user was not allowed to use BASH.

已为Apache用户在/etc/passwd中将bin/false更改为bin/bash.

Had to change bin/false to bin/bash in /etc/passwd for apache user.

事后看来,仅添加bin/mogrify可能会更好

In hindsight might be better to just add bin/mogrify

这篇关于php exec()返回空值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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