I want to set it up so that PHP scripts can only read/write files contained in a certain directory and nowhere else on the hard drive (preferably, per virtual host).

I figured I could do this by creating a new (unfortunately, windows) user and restricting its access to all partitions, explicitly allowing access to the folder in question only. That did not work because I couldn't start apache, since it lacks reading permissions. I don't necessarily want to grant the user reading permissions to any location else than it's particular folder. (kind of how web hosting companies do it)

Is there any way I can configure this?


I do not believe it is possible to run suPHP on a Windows-based Apache installation.

That said, you can restrict access by creating a service user account for Apache and granting it Run-As-A-Service permissions as well as read access to all content that you would like to serve. If there are parent directories that need to be secured between the content and the root of the drive, you will likely need to grant the service user account Directory Traversal permissions to the entire path, as well as read permission on the content.

With this configuration, you will be able to prevent Apache/PHP from accessing unauthorized content/files using NTFS file access permissions.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.