Freedom-n-Democrazy Posted October 11, 2011 Share Posted October 11, 2011 I'm getting this error when I try to fwrite to a directory: failed to open stream: Permission denied I have added the user www-data to the group which has permission to the directory? The directory is this: /home/directory1/documents directory1 = drwxr-x--- documents = drwxrwx--- Does anyone know whats going on? Quote Link to comment https://forums.phpfreaks.com/topic/248866-getting-failed-to-open-stream-permission-denied-but-im-sure-process-is-runn/ Share on other sites More sharing options...
Drummin Posted October 11, 2011 Share Posted October 11, 2011 Do you have the file open in another editor? Quote Link to comment https://forums.phpfreaks.com/topic/248866-getting-failed-to-open-stream-permission-denied-but-im-sure-process-is-runn/#findComment-1278018 Share on other sites More sharing options...
Freedom-n-Democrazy Posted October 11, 2011 Author Share Posted October 11, 2011 No. Quote Link to comment https://forums.phpfreaks.com/topic/248866-getting-failed-to-open-stream-permission-denied-but-im-sure-process-is-runn/#findComment-1278019 Share on other sites More sharing options...
Freedom-n-Democrazy Posted October 11, 2011 Author Share Posted October 11, 2011 When I login as www-data I can write to the path fine. Why won't Apache do it? Apache is running as root > www-data. <?php $fp = fopen("/home/directory1/Documents/feedback.txt", "a"); fwrite($fp, "".$_POST['feedback']." - ".$_SERVER['REMOTE_ADDR']."\n"); fclose($fp); echo "Done."; ?> Quote Link to comment https://forums.phpfreaks.com/topic/248866-getting-failed-to-open-stream-permission-denied-but-im-sure-process-is-runn/#findComment-1278021 Share on other sites More sharing options...
Freedom-n-Democrazy Posted October 11, 2011 Author Share Posted October 11, 2011 I have narrowed the problem down to an operating system problem. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/248866-getting-failed-to-open-stream-permission-denied-but-im-sure-process-is-runn/#findComment-1278024 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.