Reputation: 3350
everyone. I'm trying to write a PHP script that reads and writes files from a secure directory. That is, a directory that users can't access. I put the "deny from all" in the .htaccess of said directory, and PHP scripts can read files from that directory without error. However, I cannot write files to that directory. I get a Permission Denied error when I try to use fopen with the "w" option.
Does anyone know how to fix this?
Upvotes: 0
Views: 146
Reputation: 3350
I figured it out. I couldn't use chmod from the PHP script and change permissions ("Operation not permitted"), I had to chmod from the terminal and change permissions. Thanks for the suggestions.
Upvotes: 0
Reputation: 2265
Use is_writable() function in php to check whether you have permission to write in to a directory. If not you can use chmod() to change the permission and write to it.
Upvotes: 2