Error on mount through php “exec”

微笑、不失礼 提交于 2019-12-01 10:59:01

问题


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!!



来源:https://stackoverflow.com/questions/4455841/error-on-mount-through-php-exec

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!