[英]How to edit / save files on remote shared folder from Wampserver 3 installed on Windows 10?
it's been for a while that I'm trying to save files to a remote shared folder (\\192.168.1.134) from my Wampserver on a windows host.我已经有一段时间试图将文件从 Windows 主机上的 Wampserver 保存到远程共享文件夹 (\\192.168.1.134)。 I run a .bat script from PHP but nothing is saved.我从 PHP 运行 .bat 脚本,但没有保存任何内容。 The script run well because I can execute it from a CMD prompt and I can also run another .bat script with PHP that write into a .txt (on the host).该脚本运行良好,因为我可以从 CMD 提示符执行它,我还可以使用 PHP 运行另一个 .bat 脚本,该脚本写入 .txt(在主机上)。
So there it is, I'm sure it's not because of my PHP script, but on permissions that Wampserver got (I can easily write and edit file on the shared folder with host).所以就是这样,我确定这不是因为我的 PHP 脚本,而是因为 Wampserver 获得的权限(我可以轻松地在与主机的共享文件夹上编写和编辑文件)。
I read that Wampserver may run as another User, but I didn't understand how to do it.我读到 Wampserver 可以作为另一个用户运行,但我不明白该怎么做。 Then, even if I change the User, where can I check if it has permissions to edit files in the shared folder ?那么,即使我更改了用户,我在哪里可以检查它是否有权编辑共享文件夹中的文件?
Thanks for any help !谢谢你的帮助 !
WAMPServer or rather Apache in WAMPServer is (luckily and correctly) setup so that Apache cannot get access to anything other than what it is supposed to. WAMPServer 或 WAMPServer 中的 Apache 已(幸运且正确)设置,以便 Apache 无法访问除它应该访问的内容之外的任何内容。 Its a security thing, so if your site gets hacked a hacker does not get carte blanche to access anything anywhere.这是一个安全问题,因此如果您的网站遭到黑客入侵,黑客将无法全权访问任何地方的任何内容。 So you need to setup an Alias within the Virtual Host for this site you are currently dealing with to allow Apache access to this other area因此,您需要在当前正在处理的此站点的虚拟主机中设置别名,以允许 Apache 访问其他区域
So edit your Virtual Host definition for this site and add因此,编辑此站点的虚拟主机定义并添加
Alias /ICallItThisInMyScript //192.168.1.134/path_here/
And also give access to that alias并且还可以访问该别名
<Directory //192.168.1.134/path_here/>
Require all granted
</Directory>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.