I need help properly setting up my Ubuntu LAMPP server so I can do Drupal development without issues. Currently the issue I am running into is that Drupal is unable to automatically create the settings.php file during installation. During installation of Drupal 8 and Drupal 7, I get the following error message. Note: Drupal was downloaded using the Drush command drush dl drupal-8
The Settings file does not exist.
The Drupal installer requires that you create a ./sites/default/settings.php as part of the installation process. Copy the ./sites/default/default.settings.php file to ./sites/default/settings.php. More details about installing Drupal are available in INSTALL.txt.
Yes I understand a simple solution would be to manually fix the permission issue or create the settings.php as described in this document, https://www.drupal.org/docs/7/installing-drupal-7/step-3-create-settings.... However, my goal is not that. I want to properly setup the LAMPP server so that I don't have to deal with this issue all the time. On my Windows XAMPP environment, I am not getting this issue.
Below are the steps I used to setup my Ubuntu LAMPP server:
- I installed a LAMPP server on Ubuntu 14 LTS using
sudo apt-get install lamp-server^as described here: https://help.ubuntu.com/community/ApacheMySQLPHP - I change permissions of the /var/www folder as listed below and suggested in this post: https://askubuntu.com/a/209547/660855
- Add myself to the www-data group using:
sudo adduser $USER www-data - Change ownership of /var/ww folder using
sudo chown $USER:www-data -R /var/www - Give 755 permissions:
sudo chmod u=rwX,g=srX,o=rX -R /var/www - Finally download a fresh copy of Drupal using drush:
drush dl drupal-8
Below is list of files and permissions:
imgweb@imgweb-K52F:/var/www/html/drupal-8.3.6/sites$ namei -m -o /var/www/html/drupal-8.3.6/sites
f: /var/www/html/drupal-8.3.6/sites
drwxr-xr-x root root /
drwxr-xr-x root root var
drwxrwsr-x www-data www-data www
drwxrwsr-x imgweb www-data html
drwxrwsr-x imgweb www-data drupal-8.3.6
drwxrwsr-x imgweb www-data sites
imgweb@imgweb-K52F:/var/www/html/drupal-8.3.6/sites$ ls -l
total 20
drwxrwsr-x 3 imgweb www-data 4096 Aug 2 17:54 default
-rw-rw-r-- 1 imgweb www-data 310 Aug 2 11:27 development.services.yml
-rw-rw-r-- 1 imgweb www-data 4022 Aug 2 11:27 example.settings.local.php
-rw-rw-r-- 1 imgweb www-data 2337 Aug 2 11:27 example.sites.php
-rw-rw-r-- 1 imgweb www-data 515 Aug 2 11:27 README.txt
imgweb@imgweb-K52F:/var/www/html/drupal-8.3.6/sites$ cd default/
imgweb@imgweb-K52F:/var/www/html/drupal-8.3.6/sites/default$ ls -l
total 44
-rw-rw-r-- 1 imgweb www-data 6762 Aug 2 11:27 default.services.yml
-rw-rw-r-- 1 imgweb www-data 30755 Aug 2 11:27 default.settings.php
drwxrwxr-x 2 www-data www-data 4096 Aug 2 17:54 files
imgweb@imgweb-K52F:/var/www/html/drupal-8.3.6/sites/default$
With the above steps, Drupal still couldn't automatically create settings.php file, so I tried using 775 permissions also. The group www-data should have write privileges, but still Drupal can't create the settings.php file. Infact, for fun, I did sudo chmod -R 777 /var/www/html/drupal-8.3.6. This also didn't allow Drupal to automatically create the settings.php file.
Am I missing something in my Apache configurations?
My current temporary solution is to override the User and Group in /etc/apache2/apache2.conf from default to my own username.
#User ${APACHE_RUN_USER}
#Group ${APACHE_RUN_GROUP}
User imgweb
Group imgweb