将afp挂载为其他用户以进行php访问 [英] Mounting afp as different user for php access
问题描述
我已经将afp目录afp://ServerName/Foo/通过"Finder-> Go-> Connect to Server"安装到/Volumes/Foo,现在我尝试使用以下方式访问它:
I've mounted an afp directory, afp://ServerName/Foo/, with "Finder->Go->Connect to Server" to /Volumes/Foo, now I'm trying to access it with:
opendir("/Volumes/Foo/dirname/");
但是,我得到了一个
Warning: opendir(/Volumes/Foo/dirname/) [function.opendir]: failed to open dir: Permission denied in...
安装在终端上给我: /Volumes/Foo(afpfs,nodev,nosuid,由Daniel挂载)上的afp_1VqvPY000e413wKcJE13gANY-7.2d000004
mount in terminal gives me: afp_1VqvPY000e413wKcJE13gANY-7.2d000004 on /Volumes/Foo (afpfs, nodev, nosuid, mounted by daniel)
所以我需要将文件夹挂载为_www,或者以某种方式允许_www使用我的挂载.我该怎么做其中之一?我想我可能想使用_www之类的东西,但是我不知道如何使用终端.
So I need to mount the folder as _www, or somehow allow _www to use my mount. How can I do either one of these? I'm guessing I want to possibly su to _www or something, but I don't know how to with terminal.
推荐答案
应该能够在终端中将卷安装为_www.
Should be able to mount the volume as _www in the terminal.
sudo -u _www mount_afp -I //user@host/share /path/to/mountpoint
.
如果要在URI中指定密码,请省略-I
.
sudo -u _www mount_afp -I //user@host/share /path/to/mountpoint
.
Omit -I
if you want to specify the password in the URI.
可以或者在脚本中使用system()
或exec()
来使用mount_afp
.
Either that or you could use mount_afp
using system()
or exec()
from within the script.
如果用于Web服务器,则可能需要考虑在启动时自动挂载共享.
If it is for a web server you will probably want to look into automatically mounting the share at startup.
这篇关于将afp挂载为其他用户以进行php访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!