title: Permission denied in Apache instead of 777
body: <p>I am having a hard time deploying a PHP website built using <a href="https://getgrav.org/" rel="nofollow noreferrer">Grav</a> on CentOS. </p>
  
  <p>Whenever I try to open the website I get 500 Server Error. The logs say:</p>
  
  <pre><code>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:\...
  </code></pre>
  
  <p>I followed the guide mentioned <a href="https://learn.getgrav.org/troubleshooting/permissions" rel="nofollow noreferrer">here</a> but it didn't helped. </p>
  
  <p>Then, I did <code>chmod 777 -R glug_nith/</code> but still it doesn't work. I even logged into <code>apache</code> user using <code>sudo -u apache bash</code> to see if I am able to create folders and files inside myapp and I was successful. I tried deleting the <code>.htaccess</code> file to see if that would help but it didn't.</p>
  
  <p>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.</p>