I have a relatively simple custom installation profile for Drupal 8.
All it does is:

  • Ask for the sites domain name and the name of the theme it should scaffold.
    • Use the domain name to create the proper multi-site folder in /sites/<domain-name>
    • Use the theme name to create a theme folder under the multisite folder: /sites/<domain-name>/themes/custom/<theme-name>
    • Copy the relevant example files to the domain and theme folder, from the default site.

The problem I'm having is that it fails at creating the folders, due to it not being permitted to create the folders. The /sites is set to permission 0755, and the problem is only fixed if I set sites to have permission 0777.

The folders are created using PHP's mkdir() function, as is set to create the folders recursively.


  1. Is there a better way to make folders during installation, than using php's mkdir(), that would fix my permission issue?

  2. My assumption would be that the script (drupals installation UI) is being run as a different user than the one who owns the folder/filers of the site (installed via cli git and composer). How to I check which user the script is being run under? (using apache2 on centos7, in case it is relevant)

1 Answer 1


You've setup the Drupal code from the command line and now run the install from UI? Then this is normal if you have different users for the command line and the webserver, which is recommended. Only cheap hosters use one user for both. Drupal is supposed to have write access only for the sites/*/files folder and temporarily for settings.php during installation.

So you need to run this from the command line. Build the folders in a script or install the profile with a console command, which probably works without that you need to change anything in code.

Btw. this is why installing Drupal from the command line is so efficient, you get the permissions right from the start.

  • So if I had to explain this to a colleague, could I safely say that this is intended result when setup is done via CLI (composer) and install is done via UI (Webbrowser) as a result of CLI and web being run under different users? Just trying to keep it short so they can quickly read and understand it. Aug 15, 2017 at 6:12
  • Yes, this is correct.
    – 4uk4
    Aug 15, 2017 at 6:27
  • Installing it via CLI works fine, except that after the install, if I go to the site, it throws me a bunch of errors about being unable to create the /files directory and it's subdirectories. I know this is for the same reason as the install failing when using the ui (different users), but how can I now be sure that any of drupals file system works, if it can't create it's own folders? Aug 15, 2017 at 6:43
  • It can't create it's own files folder. Look in the installation instructions, it is explained there that Drupal needs your help for this.
    – 4uk4
    Aug 15, 2017 at 7:09
  • If you mean drupal.org/docs/user_guide/en/install-run.html then I've found zero mention of that anywhere in those docs, do you have a link to the ones you're talking about? Aug 15, 2017 at 7:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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