The user that the web server is running as would need to own the files / directories that the web server is writing to. Look at the first part of Kyle's suggestion.
>> *Webservers, on Ubuntu, usually run as the www-data user. Either chown this >> directory to www-data,* or make the permissions more open by letting "other" >> write: chmod o+wx On Sun, Apr 8, 2012 at 9:01 AM, Karl-Arne Gjersøyen <[email protected]> wrote: > I resolve the error when chmod 777 on public_html. > But I have read it has someting to do with the server configuration. > Were can I configure the server to accept file_put_content() when the > directory chmod is 755? > > Thanks for your time. > > Karl > > Den 15:44 8. april 2012 skrev Kyle Johnson <[email protected]> følgende: >> >> On Apr 8, 2012 9:13 AM, "Karl-Arne Gjersøyen" <[email protected]> wrote: >>> >>> Hello. >>> I am not sure this have to do with my Ubuntu server or it have to do >>> with the PHP installation. >>> >> >> Hello. Your issue seems to be a file permission problem. >> >>> When using file_put_contents() in PHP I got this error: >>> Warning: file_put_contents(3128a463470a06f833c9787fdf0c58dc.png) >>> [function.file-put-contents]: failed to open stream: Permission denied >>> in /home/test/public_html/cptcha.php on line 62 >>> >>> Here is the directory and the permittion on my server: >>> >>> ls -l / >>> drwxr-xr-x 8 root root 4096 2012-04-08 13:30 home >>> >>> ls -l /home/ >>> drwxr-xr-x 4 test test 4096 2012-04-08 13:31 test >>> >>> ls -l /home/test/ >>> drwxr-xr-x 2 test test 4096 2012-04-08 14:54 public_html >>> >>> karl@ubuntu:~$ ls -l /home/test/public_html/ >>> totalt 772 >>> -rw-r--r-- 1 test test 778552 2012-04-08 13:58 arial.ttf >>> -rw-r-r-- 1 test test 1670 2012-04-08 14:54 cptcha.php >>> -rw-r--r-- 1 test test 1709 2012-04-08 14:43 spamTest.php >>> karl@ubuntu:~$ >>> >> >> Webservers, on Ubuntu, usually run as the www-data user. Either chown this >> directory to www-data, or make the permissions more open by letting "other" >> write: chmod o+wx . >> >>> Hope you can help me. >>> Thanks for your time! >>> >>> Karl >>> -- >>> Hjemmeside: http://www.karl-arne.name/ >>> Homepages: http://blog.karl-arne.name/ >>> >> >> Hope this helps, >> -kyle >> >>> -- >>> ubuntu-server mailing list >>> [email protected] >>> https://lists.ubuntu.com/mailman/listinfo/ubuntu-server >>> More info: https://wiki.ubuntu.com/ServerTeam > > -- > ubuntu-server mailing list > [email protected] > https://lists.ubuntu.com/mailman/listinfo/ubuntu-server > More info: https://wiki.ubuntu.com/ServerTeam
-- ubuntu-server mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-server More info: https://wiki.ubuntu.com/ServerTeam
