We use an automated deploy system when developing with Craft.

We have a deploy user "deploy" and a web server user "www-data"

Deploy is a member of the www-data group.

Our first few deployments went fine but when we hit the point where the system started deleting old version (15 or so in) we started getting errors where it couldn't delete the old files properly.

On examination folders created here - /craft/storage/runtime/compiled_templates have the permission drwxr-xr-x so only www-data can edit/write to them. Is there anyway we can make this group writable when created rather than having to do a manual clean up?


Normally folders in the /craft/storage/runtime/* directory are just cached files.

Those files are generated by craft, so really they're generated by php/php-fpm/nginx/apache or what ever you've got setup. Maybe check the user that made those folders are in the www-data group if you do want to look into it further.

The better solution is to completely ignore that folder... Those files do not need to be deployed at all. They're just cached files generated by Craft. So just ignore that directory from your repo completely.

  • 1
    +1 on not deploying anything in the storage directory, would avoid the problem. Apr 2 '15 at 11:07

When Twig creates folders and files within the runtime/compiled_templates folder, it will attempt to create them with 777 and 666 permissions, respectively. However it is restricted by the maximum permissions that server will allow it to use, which is 644 by default (preventing files from being set with permissions that would allow them to be overwritten by another user group).

You could theoretically work around this by changing your server’s umask, but you’re probably better off keeping it set to 022 and just avoiding deploying anything within the runtime folder in the first place, since it’s not necessary to begin with.

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.