Oftentimes this question comes up for WAMP –
How do I
chmod 777(change) filesystem permissions for Apache and PHP to be able to read/write this file/folder on Windows?
The simple answer is you don’t, and you don’t need to. And here is 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.
For example, when you are using WordPress to upload a file (and already have the wp-content\uploads folder created), WP already has the needed permissions to be able to create a new sub-folder for the year + month in the uploads folder, and move that file in from the temporary folder. No file permission changes are needed. No php.ini edits are needed. No WP settings changes are needed.
If there is a problem with the above example –
- The additional file permissions that have been set up afterwards are at fault (check Windows Event viewer).
- Settings have been wrongly edited: WP upload path settings, php.ini temp folder location + upload settings, etc.
- The Apache Service ‘Log On’ account has been switched from “LocalSystem” to something else (check Service’s Properties).
- Or there are internal PHP errors (check the website’s HTTP and PHP error logs).
If you really really need to run
chmod (read/write permissions) and
chown (ownership) for some reason, 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 use Windows native methods and commands to set the 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.
You can even use a PHP script to do this, as PHP has
Aside form that, to set file-permissions under Windows, using Windows 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…