1

I've configured Apache vHosts on a local box and installed a Craft 3 website onto it. This new instance will serve as my "staging" environment for an upcoming website.

  • I've installed with composer from a Git repo of my work-in-progress site.

Everything installed fine, and I can access the site through my browser. However, the site displays the error message:

/var/www/vhosts/wine/storage isn't writable by PHP. Please fix that.

Now, I've run into this before, normally I would just chmod 775 and chown the folder to apache. But, this isn't working. I've even chmod 777 on the folder and it still gives me the error message.

An ls -la on the storage folder gives me (currently 774):

drwxrwxr--.  2  apache apache 

This should be working. I've been at it for 4 hours, and I'm at a loss. If anyone has any ideas, please let me know.

  • CentOS 7
  • Apache 2.4.6
  • PHP 7.2.20
  • I'm assuming Apache is configured to run PHP as apache:apache? – Brad Bell Aug 16 at 20:30
  • Yes, that's correct @BradBell – Palmtree Studios Aug 19 at 18:01
  • Actually, @BradBell I'm not 100% sure of this. I know Apache is set to exclusively run as apache:apache, and I'm assuming PHP uses that configuration as well. However, any of the PHP modules might be running as some other user, and I'm unsure of how to check this. – Palmtree Studios Aug 19 at 18:07
  • So, an update: Disabling SELinux allowed apache/PHP proper access, which seems to suggest ther MUST be a SEL policy set up. However, this is also weird, because I did set up a policy on storage at one point to no avail. Oh well, since this is a staging server, I'm going to leave SEL disabled. If I have the same issues on Production, I'll investigate further. If you have any advice @BradBell, please let me know. Thanks. – Palmtree Studios Aug 19 at 20:03
  • Huh... I've got zero experience with SEL. – Brad Bell Aug 19 at 22:00
1

Disabling SELinux worked, but only as a workaround. This particular issue was on a Staging server, so disabling SEL was not a huge issue.

However, I would highly recommend not anyone else do this for a Production environment unless they really know what they're doing in terms of permissions.

Good luck.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.