1. Create a database, database user (with all permissions) and a database user password. Most hosting environments let you do this from a mySQL link in the Control Panel. You can administer the database using phpMyAdmin, also accessible from the Control Panel.

  2. Be sure that your webpage hosting environment for PHP is at least PHP 7.0. The newer the better. Be sure that your command line PHP version is also at least 7.0. Change the php settings to allow the maximum size memory for php, and file sizes for uploads.

  3. Install composer in your root directory: https://getcomposer.org/download/. Follow their php steps,

  4. Link composer.phar to composer (for convenience):

    ln -s composer.phar composer

  5. Install drupal itself from root directory using

    composer create-project drupal/recommended-project public_html
    Note that public_html must be empty!
  6. Move composer into the public_html directory.

  7. Install drush using composer:

    php composer require drush/drush

    ln -s vendor/drush/drush/drush ./drush

  8. Create a .htaccess file in the public_html directory
    RewriteEngine on
    RewriteRule (.*) web/$1 [L]

  9. To avoid a "Redirects to external URLs are not allowed by default," put these lines at the end of web/settings/default/settings.php:
    if (isset($GLOBALS['request']) and
        '/web/index.php' === $GLOBALS['request']->server->get('SCRIPT_NAME')) {
        $GLOBALS['request']->server->set('SCRIPT_NAME', '/index.php');

  10. In Drupal 9, you must drinkl the Kool-Aid and use Composer to install, uninstall, and update your site. For me, the GUI for updating modules inside the Drupal Web pages no longer work. for example,

    composer update

    will update your site, even to a new Drupal Core version. Sometimes, it may ask

    Discard changes [y,n,v,d,?]?

       y - discard changes and apply the uninstall

       n - abort the uninstall and let you manually clean things up

       v - view modified files

       d - view local modifications (diff)

       ? - print help

    and you want to answer yes. Answer yes a second time to actually update the symfony files inside the Drupal distribution

  11. You should install additional modules using composer:
    composer require drupal/module_name

  12. You can enable a module from the command line using drush:
    drush en module_name -y

  13. At this point, it is a good time to check that your site is still working. Check for errors:

    ./drush watchdog-show

    or do this from the GUI Reports/Recent log messages. Using drush can help you to find errors if your GUI breaks with the infamous "The website encountered an unexpected error. Please try again later." message.

  14. Update your database using drush whenever you update or install a new module.

    ./drush updatedb   (or updb)

  15. ./drush cr

    will update the list of installed modules so that you can enable them from the Extend menu.

  16. Now install your initial module set using composer. I recommend stopping occasionally to check that your site is still working. Installing admin_menu totally trashed my site. (Use admin_toolbar instead.). If you are updating your site from a previous version of Drupal (6 or 7), install all of the modules that were activated in your old site, and make a list of those unavailable in Drupal 8. Using composer to install modules also installs their required libraries and enters the modules into the composer.json and composer.lock files. Installing from the Extend menu does not do these things.

    composer require drupal/your_module_name

  17. While you are doing the above, use the GUI Extend web page to find and activate each newly-installed modules to be sure nothing is going wrong.

  18. Clear your caches after any big change to see the result

    ./drush cr

    and now is a good time to back up your database using phpMyAdmin. Also zip up your Drupal directory, for example:

    zip -r d8-10-22-2018.zip d8

  19. So, in general, to update things, you want to do
    composer update
    ./drush updb
    ./drush cr

  20. You should now run a status report. You will probably find the following, but you should NOT fix this until your site is moved to its final location.


    Not enabled

    The trusted_host_patterns setting is not configured in settings.php. This can lead to security vulnerabilities. It is highly recommended that you configure this. See Protecting against HTTP HOST Header attacks for more information.

  21. If you are upgrading from a previous Drupal version, now is the time to run your update. Be sure to install and enable all of the update modules first.


    especially Migrate Drupal UI unless you wish to upgrade using drush. It is a good idea to copy all of your public files to the new site (if you want them) before the upgrade.

What if things go wrong?

Here is an example of what can go wrong with Composer:

  Failed to execute git clone --no-checkout 'https://git.drupal.org/project/coder.git' 
  /vendor/drupal/coder' --dissociate --reference 
  t-coder.git/' && cd '/home2/orcmaorg/public_html/vendor/drupal/coder' 
&& git remote add composer 'https://git.drupal.org/project/coder.git' 
&& git fetch composer
  Cloning into '/home2/orcmaorg/public_html/vendor/drupal/coder'...
  fatal: unable to create thread: Resource temporarily unavailable
  fatal: cannot repack to clean up

Note that the URL in red does not exist. You need to search the bugs in the coder project to find https://www.drupal.org/project/coder/issues/2919773#comment-12846434
which says the code is at https://github.com/klausi/coder

There are two files that Composer creates and updates (an important reason to do things using Composer and not the GUI).

  • composer.json lists all the system modules in your Drupal, and which versions of each module is needed. I ran into problems with entity_update, which is required by drush (I think):
          "drupal/entity_update": "^1.1"
    but it needed to be
           "drupal/entity_update": "^1.2@RC"
    so I edited this file.
  • composer.lock gives the name of each system module, and all of its metadata, including where to get the module. It is here that you have to fix the above URL:
                "name": "drupal/entity_update",
                "version": "1.2",
                "source": {
                    "type": "git",
                    "url": "https://git.drupal.org/project/entity_update",
                    "reference": "8.x-1.2-rc7"
                "dist": {
                    "type": "zip",
                    "url": "https://ftp.drupal.org/files/projects/entity_update-8.x-1.2-rc7.zip",
                    "reference": "8.x-1.2-rc7",
                    "shasum": "1da5f2de7c6adcda9eac8140b5406e588910d50b"
                "require": {
                    "drupal/core": "~8.0"
                "type": "drupal-module",
                "extra": {
                    "branch-alias": {
                        "dev-1.x": "1.x-dev",
                        "dev-master": "1.2.x-dev"
                    "drupal": {
                        "version": "8.x-1.2-rc7",
                        "datestamp": "1515696784",
                        "security-coverage": {
                            "status": "not-covered",
                            "message": "Project has not opted into security advisory coverage!"
                "notification-url": "https://packages.drupal.org/8/downloads",
                "license": [
                "authors": [
                        "name": "Nuwantha",
                        "homepage": "https://www.drupal8.ovh",
                        "role": "Admin"
                "description": "Update Drupal 8 Entity schema.",
                "homepage": "https://www.drupal.org/project/entity_update",
                "support": {
                    "source": "
                    "issues": "https://www.drupal.org/project/issues/entity_update"

But making these changes still gave the same error message!

Composer makes a .composer directory above your Drupal main directory. Inside of this is a cache directory. It too must be deleted. Then everything will work.

Drupal 8 should not be this difficult!!!!

Finding things inside Drupal

I grabbed these tips on how to find things that are referred to in your Drupal installation, but are missing:

Do the following:

grep -rnw '/path/to/somewhere/' -e "pattern"

  • -r or -R is recursive,

  • -n is line number, and

  • -w stands match the whole word.

  • -l (lower-case L) can be added to just give the file name of matching files.

  • Along with these, --exclude or --include parameter could be used for efficient searching. Something like below:

grep --include=\*.{c,h} -rnw '/path/to/somewhere/' -e "pattern"

This will only search through the files which have .c or .h extensions. Similarly a sample use of --exclude:

grep --exclude=*.o -rnw '/path/to/somewhere/' -e "pattern"

Above will exclude searching all the files ending with .o extension. Just like exclude file it's possible to exclude/include directories through --exclude-dir and --include-dir parameter; for example, the following shows how to integrate --exclude-dir:

grep --exclude-dir={dir1,dir2,*.dst} -rnw '/path/to/somewhere/' -e "pattern"


grep -Ril "text-to-find-here" /

Add new comment


  • No HTML tags allowed.
CAPTCHA This question is for testing whether or not you are a human visitor and to prevent automated spam submissions. Image CAPTCHA

Enter the characters shown in the image.