1

Basic php and javascript website No errors on Wamp When I put the files on my Lamp server everything works except for this error I get on the top of the page

Warning: file_put_contents(donneesDonut.json): failed to open stream: Permission denied in /var/www/html/bp/action/IndexAction.php on line 101

I looked around and most people suggest to change the permission of the file or the entire directory on apache. chmod 777 did nothing for me.

I'm new to web servers so I probably have missed some apache configuration for permissions during the installation process

Here is a screenshot of the directory Directory listing

I don't think there is a problem with the code since it works on my local Wamp server but here is the line of code that gives me the error.

file_put_contents($this->json, json_encode($this->donneesDonut));

If you need any other information like specific apache configuration please tell me where to get them.

Hope you can help

honeyspoon
  • 1,354
  • 1
  • 11
  • 13
  • None of the directories in your screenshot have a 777 permission. There's already a donneesDonut.json file owned by root. I'd suggest creating a new directory and have it owned by the web user and upload the file there. – aynber May 09 '17 at 18:01

1 Answers1

1

The problem was SELinux with was set to enforce by default on Centos

honeyspoon
  • 1,354
  • 1
  • 11
  • 13