-->

Error on mount through php “exec”

2019-02-20 13:03发布

问题:

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:

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