Jump to content

Allowing File Write Permissions on Apache


Fmdpa

Recommended Posts

I have a PHP program that allows the upload of files. Upon the upload, the main image is duplicated and a thumbnail should be generated and saved. Well, that's what should happen. Unfortunately, I was given an error that basically said that the selected directory did not allow files to be written. How, on Apache, should I fix this so that the selected directory can have .jpeg, .jpg, .png and .gif files written in it? Also how can I disable CGI script execution in that particular directory (for added security)? Should this be done in the .htaccess or httpd.conf file? I can't really figure out what the difference is.

Link to comment
Share on other sites

The difference between .htaccess and httpd.conf is that httpd.conf settings are applied at the start of Apache. You need to restart Apache for changes in httpd.conf to take effect. Settings in .htaccess are applied per request. You just need to rerequest the page to apply the new settings. Because Apache needs to check if there is .htaccess, and if the settings are any different, having .htaccess makes your pages load slightly slower, but on shared hosts, where they don't allow you to alter their httpd.conf (because they don't want to restart their server every time someone wants to make a change), that performance penalty is totally worth it.To disable script execution in a directory, use

<Directory "D:/Path/To/Directory">Options -ExecCGI</Directory>

To alter the permissions of a folder, on Windows, you'll need to right click and select "Properties". Then check out the "Security" tab. It contains permission details. You need to find out the user Apache is running as and give it writing permissions... or just let "Everyone" have writing permissions.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...