简体   繁体   中英

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. I run a .bat script from PHP but nothing is saved. 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).

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).

I read that Wampserver may run as another User, but I didn't understand how to do it. 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. 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

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM