how to setup existing website with lando drupal 8 | how to setup existing website with lando drupal 9 | lando existing drupal site

As, i have posted how to start working with lando for drupal 8, drupal 9 projects from the scrach.

But when we have existing projects, then how to setup with lando.

Today i am goining to write a simple blog to setup exisitng project with lando, step by step.

Let’s started.

Note: Make sure, you must have install lando.


You can install new Drupal 9 site using composer with lando.

Upgrade drupal core 8.7 core to drupal recommended 8.9.19

Step 1: download your source code and put it on you Lando Root directory.

Inside Drupal 8 root directory

Step 2: Create .lando.yml in root of your project and paste the below code.

name: khaitan9update
recipe: drupal8
  webroot: web
  php: '7.4'
  composer_version: '2.1.9
  • name: Name of Your codebase
  • recipe: Drupal 8, because this project build in drupal8, we will update it drupal 9 later.
  • webroot: web which is web root directory.
  • you can specify php version as well composer_version.

Step 3: Create settings.lando.php file inside web/sites/default and paste the below code.

 * @file
 * Lando settings.
// Configure the database on Lando

// Set the database creds
$databases['default']['default'] = [
  'database' => 'drupal8',
  'username' => 'drupal8',
  'password' => 'drupal8',
  'host' => 'database',
  'port' => '3306',
  'driver' => 'mysql',
  'prefix' => '',
// And a bogus hashsalt for now
$settings['hash_salt'] = json_encode($databases);

global $content_directories;
$content_directories['sync'] = $app_root.'/../content/sync';

Step 4: add below code in setting.php file which is web/sites/default.

if (getenv('LANDO')) {
  if (file_exists($app_root . '/' . $site_path . '/settings.lando.php')) {
    include $app_root . '/' . $site_path . '/settings.lando.php';

Step 5: run below command.

lando start
Lando Start
Lando Start

Step 6: Now import db for connecting CMS to database.

lando db-import dbkhaitan-19-10-2021.sql
Lando db-import dbname
Lando db-import dbname

Note: make sure if, lando db-import dbname, will not work then run lando rebuild -y

Step 7: Now, you can able to access your CMS, just login and use it.

Drupal 8 core version
Drupal 8 core version

Pradip Mehta

I am a well-organized professional in Drupal Development and PHP web development with strong script handling knowledge or automation process with PHP. I have advanced computer skills and am a proficient multitasker.

Leave a Reply