Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Web Server Configuration _ Linux Permissions

Posted by: FrostTaco Apr 28 2016, 03:38 PM

Hi guys, so i get this PHP error:

CODE
PHP Warning:  fopen(cache//afile.json): failed to open stream: Permission denied in /var/www/index.php on line 55

I know the chmod command, but don't know if thats what i need to use, and if i do need to use that, I don't know how to give my PHP permission. Any help is appreciated!

Posted by: FrostTaco Apr 29 2016, 03:17 PM

Sorry for making this guys, just found the answer!

Posted by: Frederiek Apr 30 2016, 07:14 AM

Good.
It would be nice though if you could post your solution, so anyone with a similar problem can benefit from that.
That's a purpose of the forums too.

Posted by: imort Jun 18 2016, 07:35 AM

QUOTE(FrostTaco @ Apr 29 2016, 02:38 AM) *

Hi guys, so i get this PHP error:
CODE
PHP Warning:  fopen(cache//afile.json): failed to open stream: Permission denied in /var/www/index.php on line 55

I know the chmod command, but don't know if thats what i need to use, and if i do need to use that, I don't know how to give my PHP permission. Any help is appreciated!


You need to make sure that your file '/cache/afile.json' have read permissions for apache process
Usually you can just run 'chmod a+r cache/afile.json' to make sure that everyone can read that file. Almost sure that apache doesn't need to change it.
You also can run 'chown www-data:www-data /var/www -R' to make sure that apache process have all rights on those files too.
It can be dangerous in the production environment but still good for the test or development server.

Take a look https://serversuit.com/community/technical-tips/view/these-key-elements-of-access-permissions-are-everything-to-your-linux-server-security.html to find more examples about Linux file permissions too.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)