Posted: 2014-08-13 22:33:34
Oftentimes this question comes up for WAMP –
How do I
chmod 777(change) filesystem permissions for Apache and PHP to be able to create or write a file/folder on Windows?
The simple answer is you don’t, and you don’t need to. And here is exactly why…
Apache already has all the permissions it needs, as it runs under the LocalSystem account on Windows, which has extensive read/write access to local paths. This is inherited by PHP and the scripts it runs.
For example, when you are using WordPress to upload a file (into the wp-content\uploads\ folder), WP already has ALL the needed permissions it needs to be able to create a new sub-folder (year\month\) in the uploads folder, and to move the uploaded file from the temporary folder into it. No file permission changes are needed. No php.ini edits are needed. No WP settings changes are needed.
If there is a problem then –
open_basedirsetting has been enabled in VirtualHost or .htaccess and is restricting the paths PHP can access.
If you do really need to run
chmod to set read/write permissions, and
chown to set user/group ownership, there are some Windows equivalents and ports of these Linux commands that you can download – that just take the number, re-interpret it, and then apply Windows native methods and commands to set the required permissions:
But Apache, for the most part, already has *full* read and write permissions in the WAMP folder, so there is nothing that needs changing, unless: you are trying to set lesser permissions, or the script won’t install unless it is able to run chmod/chown.
You can also use a PHP script to run chown/chmod commands, as PHP has its own
Aside from that, to set file-permissions under Windows using native ways, you can right-click any folder or file, go to Properties, Security, and set the permissions there. Or use any number of command-line utilities such as the ones listed here: