I have, if I'm right, 4 hours (and followed) looking around the Stackoverflow forum (so they do not tell me to take a look at the tour), as well as multiple threads in other forums such as DigitalOcean, the solution to the famous problem of permission denied, failed to open stream, with the function file_get_contents()
I tried, by shell, doing multiple chmod
, among these, 777
, as well as chown
to the directory where the file I want to read is located, /root/test2/plugins/RLBT
This is my code:
/var/www/html/bt_api.php
<?php
...
echo file_get_contents("/root/test2/plugins/RLBT/verified.json");
And the complete error:
Warning: file_get_contents(/root/test2/plugins/RLBT/verified.json): failed to open stream: Permission denied in /var/www/html/bt_api.php on line 34
Thanks for your answers.