Permission error, cache/doctrine is not writable

#1

If setenforce is 1, I get following error:

InvalidArgumentException
The directory “/var/www/dev/public_html/GravCMS/cache/doctrine” is not writable.

However:

  • ls -l
  • drwsrwsr-x | apache | apache

For testing purposes I tried with following permissions:

  • 0777
  • 6775
  • 0775

no change.

#2

EDIT: Solution is also found at https://learn.getgrav.org/15/troubleshooting/permissions (SELinux-specific advice), somewhat missed it, assuming I was not able to connect solution to my problem. Silly me, I blame lack of coffee.

Temporary solved

Solution
Used command chcon -Rv --type=httpd_sys_rw_content_t ./ inside grav installion folder.

Reference: https://github.com/getgrav/grav/issues/912