exec没有找到一个文件 [英] exec doesn't found a file

查看:151
本文介绍了exec没有找到一个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在exec php函数中遇到问题。
当我这样做:

I'm having problems with the exec php function. When I do:

ls -al /dev/sdf1  

这没有找到存档(ls:不能访问/ dev / sdf1:没有这样的文件或目录),但是如果我运行这个命令,给我显示信息的控制台。
我该怎么办?
即使以php脚本为根,也会发生这种情况。

This doesn't found the archive (ls: cannot access /dev/sdf1: No such file or directory), but if I run this command, in console that show me the information. What can I do? That happen even running the php script as a root!!

$mountcommand = "ls -al /dev/$unit  2>&1";
exec("$mountcommand", &$mountoutput, &$mountresult);
print_r($mountoutput);
echo "\n$mountcommand\n\n";

这是一个分叉过程

推荐答案

我在这段代码和给我单位的代码之间的睡眠中修复了

I fix it with a sleep between this code and the code that gave me the "unit"

这篇关于exec没有找到一个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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