PHP OSX XAMPP - EXEC mount命令 [英] PHP OSX XAMPP - exec mount command

查看:217
本文介绍了PHP OSX XAMPP - EXEC mount命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下午好,
我目前工作的这需要一个PHP脚本安装的共享驱动器的Windows一个PHP项目。目前正在建设使用OSX与XAMPP。

Good Afternoon, I am currently working on a PHP project which requires a php script to mount a windows shared drive. Currently building using OSX with XAMPP.

exec('mount -t smbfs //user:pass@192.168.1.1/Share /Volumes/Share 2> temp/error.txt');

现在我明白为什么这是行不通的。它由于权限。 Apache是​​运行的用户守护进程。现在,我可以改变运行Apache来解决这个挑战,但要避免服务器如果可能的任何更改的用户。
我想伸手去看看有没有更好的办法去了解这一点。

Now i understand why this does not work. Its due to permissions. Apache is running as user daemon. Now i could change the user that Apache runs to fix this "challenge" but want to avoid any changes to the server if possible. I would like to reach out and see if there is a better way to go about this.

任何想法?

推荐答案

好了,我懂了工作。
我只是需要在Web服务器(用户守护进程)拥有其份额安装的文件夹。

Ok, So i got it working. I just needed the web server (user daemon) to own a folder in which the share is mounted.

E G。创建了一个名为tempshare该用户拥有守护进程,并在同一文件夹中的PHP脚本文件夹(不用担心,它会被放置到web目录的完成时)

EG. created a folder called "tempshare" that user daemon owns and is in the same folder as the php script (don't worry, it will be placed out of the web root when complete)

exec('mount -t smbfs //user:pass@192.168.1.1/Share /path/to/tempshare 2> temp/error.txt');

似乎工作。使用这种方法的安全性有什么建议?

Seemed to work. Any advice on security using this method?

这篇关于PHP OSX XAMPP - EXEC mount命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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