Error on mount through php “exec”

2019-02-20 13:35发布

I'm trying to mount an iscsi virtual disk, but if I execute the command through the exec function in php this give me that error: mount: special device /dev/sdf1 does not exist. But if I run the command directly in the console it run well!! What can I do? I'm obtaining the /dev/sdf1 in a good way, and it exists, but only through php doesn't work.

Thanks

I'm running the command with sudo and run it in console as www-data user always with sudo, so, I suppose that is the same enviroment.

sudo mount -t ext3 /dev/sdf1 /san_disks/RIBS_2

The sudoers file has this lines:

www-data    ALL = (root) /usr/bin/iscsiadm, /bin/mount, /bin/umount
%www-data ALL=NOPASSWD: ALL

And it works in console.

1条回答
时光不老,我们不散
2楼-- · 2019-02-20 13:45

This was happening because "/dev" wasn't updated. I made a sleep(1) and it works!!

查看更多
登录 后发表回答