TLDR Code Snippet
|
|
DDEV with Drupal 8,9,10
(complete step-by-step breakdown screenshot can be found at: here)
Step-1: configuration initialisation and start environment
To begin with, you will need to get a copy of the project’s filebase to your local computer, navigate to the project’s folder, and initialize the ddev configuration file there using the ddev config --project-type drupal
command:
|
|
*Optionally, you may also enter argument, such as project’s name and php’s verison, at the time of writting this post, by default, the project’s name fill be the folder’s name, and php version will be php 8.3.0
(You may find a full list of the argument at: here):
|
|
Once, the command finishes running, there’ll be a new \.ddev
directory created on the root of your project folder, and you will be able to start the project via running ddev start
, of which will start the docker container:
Step-2: install dependencies (inc. drush/drush)
Next we’ll use the ddev composer
command to install the required dependencies for ddev:
|
|
And you can even enable them using the ddev drush
command once drush gets installed:
|
|
Step-3: import database and login as admin
Lastly, to recover the project/website’s content, you also need to get a copy of the project’s database, and import it via the ddev import-db
command:
|
|
And lastly launch the project running via ddev via your browser, and login using the root user:
|
|
DDEV with Drupal 6,7
If you are using ddev with drupal 6,7, you will need to modify the type
of the ddev project, and the php_version
to match with what drupal 6,7 needs.
You may either define it during initialization phase:
|
|
Or alter it in the .ddev/config.yaml
configuration file, and run ddev restart
after the modification:
|
|
You might also have to manually override the database configuration in settings.php
with ddev’s configuration (you can find that via ddev describe
, please make sure you comment-out/delete all the other lines of code relating to database configuration; More over you should also consider replacing the base_url
with ddev’s hosted website’s url:
|
|
After editing the settings.php
, consider running ddev restart
to re-start all the containers, clearing cache; Then when everything is ready, run ddev launch /install.php
and follow the link to open the page and install the database (or use ddev import-db --file="$your_db_file_path"
to import it before opening).
More information can be found at: https://ddev.readthedocs.io/en/latest/users/quickstart/#drupal-drupal-67