Is there a way to properly set folder permissions via PHP on a Windows filesystem, such as granting user A
full access, and user B
read-only on folder \\fileserver\shares\users\A\
I can't seem to find any PHP functions for Windows filesystems for PHP
Any ideas?
Despite using the Unix file permission syntax, PHP's chmod()
function does work in Windows (I just tested it).
If your user A was the file owner and user B wasn't then it would be easy to grant one set of permissions to user A and different permissions to user B. You can set the owner of a file using the chown()
function (again, Unix-like syntax, but works with Windows, subject to your PHP program having sufficient permissions to itself to make the change).
Hope that helps.
If you have the ability to call command-line processes, you could use SetACL (if you need very detailed control) otherwise, CACLS is built in.