1

I've a development desktop having Ubuntu 10.04, Apache2 & PHP 5.3.2 installed. I've given 0777 permissions to my web application root folder and Apache2 is also running under current username. But sometimes following files error is getting,

file_put_contents(/var/www/kohana_project/application/cache/kohana_find_file_paths): failed to open stream: Permission denied.

For every request above file need to update and execute but error occurs rarely. Is any one have idea how to fix this issue ?

And one thing current logged-in user and www-data have full permissions on kohana_project directory and its contents.

1

the possible reason would be that you've not changed the owner of the file, though you've changed the permissions. :)

So first you've to get the owner name under which apache server is running, and assign the same owner to you /var/www/<file/folder>.

Follow these steps:

  1. find the owner of the httpd. Execute this command to get the owner of httpd:

    sudo ps aux | grep httpd
    

    the first column will be the owner say somebody. If you get number like 1001 or any other number instead of somebody then execute this command to get the owner name:

    grep 1001 /etc/passwd
    

    Again the first field will be the owner of the process.

  2. Now change the owner of file/folder under www to somebody

    sudo chown -R somebody /var/www/<path to the file/folder>
    
  3. Restart your server

    sudo /etc/init.d/apache2 restart
    

That's it. Hope it would help you. :)

  • Thanks for your help, I've did how you have suggested, but after executing application files ownership in cache folders are changing to www-data, anyhow +1 for reasonable answer. – Mahesh.D Feb 7 '14 at 10:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.