I am attempting to launch PHP site with apache on fedora and I've got a problem about writting permissions. It appears like apache doesn't have write permissions with a folders, however i canno realise why.

I have checked httpd.conf and contains group: apache, user: apache. Then i made: chown -R apache:apache www and hang 777 permissions towards the folders, however it still states:

Warning: file_put_contents(/var/www/public/temp.txt) [function.file-put-contents]: unsuccessful to spread out stream: Permission refused in /var/www/public/newtest.php online 8

Please advice.

UPDATE: Btw, basically make "php newtest.php" from command line, the file temp.txt is produced with group root and user root. It simply doest not work in the browser.

Warning: file_put_contents(/var/www/public/temp.txt) [function.file-put-contents]: unsuccessful to spread out stream: Permission refused in /var/www/public/newtest.php online 8

There's a lot bad stuff here.

Allows begin with because you actually want to keep httpd writeable files well from your code - certainly inside a seperate directory, ideally outdoors the document root altogether.

chown -R apache:apache www and hang 777 permissions towards the folders

And have you check later on exactly what the permissions really were? BTW see even the point above - if you have made your whole website writeable through the everyone then you are just requesting trouble. You chouldn't change Both owner And also the permissions.

Do you have SELinux enabled? (run sestatus as root). If that's the case then you definitely either have to disable it or learn to configure it - but I'd recommend you get a handle on old-fashioned permissions first, then disable SELinux.

C.

make chmod 775 to newtest.php )

ls -la /var/www/public

Simply to check :-)

perhaps you have attempted to the touch temp.txt and merely change file_put_contents() and add FILE_APPEND flag?

I'd recommend switching apache to mod_itk as mpm and running the specific vhost with permissions from the owner document root directory and contained php scripts.