0

I am having a hard time deploying a PHP website built using Grav on CentOS.

Whenever I try to open the website I get 500 Server Error. The logs say:

Uncaught exception 'RuntimeException' with message 'Creating directory '/var/www/html/glug_site/cache//compiled/files' failed on error mkdir(): Permission denied' in /var/www/html/glug_site/vendor/rockettheme/toolbox/File/src/File.php:420\nStack trace:\...

I followed the guide mentioned here but it didn't helped.

Then, I did chmod 777 -R glug_nith/ but still it doesn't work. I even logged into apache user using sudo -u apache bash to see if I am able to create folders and files inside myapp and I was successful. I tried deleting the .htaccess file to see if that would help but it didn't.

I cannot understand instead of having all the permission why its showing permission denied. Also I couldn't find any thing that might be blocking the permission. Please help.

Lokesh
  • 2,842
  • 7
  • 32
  • 47
  • 1
    It's trying to write in the `/var/www/html/glug_site/cache//compiled/files`-folder. Not your `myapp/` folder. And there is a double `//` in that path. Probably a setting that shouldn't start or end with a slash? – M. Eriksson Feb 16 '17 at 06:32
  • I used the `myapp` to refer to `glug_site`. I will fix it. Sorry for the confusion. – Lokesh Feb 16 '17 at 06:39
  • I found the `//` fishy too. How can I fix it? Any idea? – Lokesh Feb 16 '17 at 06:41
  • try `chmod 777 -R glug_site/cache/` – Saurabh Sharma Feb 16 '17 at 06:45
  • @SaurabhSharma No, it didn't worked. – Lokesh Feb 16 '17 at 06:49
  • I'm guessing that there is a config of settings file with some paths in it? Seems like there is a `/` too many in the beginning or end in one of those settings. – M. Eriksson Feb 16 '17 at 06:49
  • @MagnusEriksson I manually created the folder `compiled/files` and it stopped complaining for that folder but gave permission denied for other file/folder. So I think `//` is not a problem. – Lokesh Feb 16 '17 at 06:53
  • To be specific, now its giving the error `Uncaught exception 'RuntimeException' with message 'Opening file for writing failed on error fopen(/var/www/html/glug_site/cache//compiled/files/14c9fe43ed2de52eaddb9431486aec95.yaml.php): failed to open stream: Permission denied' in /var/www/html/glug_site/vendor/rockettheme/toolbox/File/src/File.php:202\nStack trace` after I manually created the `compiled/files` folders. – Lokesh Feb 16 '17 at 06:56
  • Did you set the correct file permissions on those folder as well, after you created them? – M. Eriksson Feb 16 '17 at 07:01
  • @MagnusEriksson No I didn't, but I just did that now. I set the permission to 777 of new created folders but still the same error. – Lokesh Feb 16 '17 at 07:04
  • 1
    @Lokesh Have you tried this: https://github.com/getgrav/grav/issues/912 – Saurabh Sharma Feb 16 '17 at 08:10
  • @SaurabhSharma You are awesome. It worked! Thanks a lot – Lokesh Feb 16 '17 at 11:13

1 Answers1

0

try uncommenting the 12th line in ur .htaccess file

Modify this

# RewriteBase /

to

RewriteBase /
Moh .S
  • 1,920
  • 19
  • 19