A comprehensive guide to debugging and monitoring in Drupal like a pro
Observing colleagues work with Drush, it’s clear they have the basics down pat. Recently, I conducted a crash course in upskilling like a pro. Moving beyond the frequent commands many have already mastered, such as:
A technical journey to resolving line ending issues in Drupal installations
In the ever-evolving landscape of web development, technical challenges are par for the course. One such challenge recently encountered involved a Drupal installation, where the popular command-line tool Drush failed to execute correctly. This article delves into the issue, the diagnostic steps undertaken, and the resolution achieved, offering insights for professionals navigating similar technical hurdles.
Using Drush to run SQL commands
To run a SQL command using Drush, use the following sql-query command
drush sql-query "COMMAND"
As an example, in the following I will remove all of the records in the Watchdog.
Delete from watchdog
To empty (clear) the watchdog table, which contains Drupal's log messages, using the above noted command. The command to delete all entries from the watchdog table is as follows:
drush/drush[12.0.0, ..., 12.2.0] require composer-runtime-api ^2.2
Resources - changing Drush
Type | Version |
---|---|
Drush (current) | 11.6.0 |
Drush (update) | 12.2.0 |
Updating Drush went OK on all testing environments until on to the staging environment.
The initial error that I saw was
Drupal 9 to 10 upgrade an example of the actual steps taken
Continuing on from the Drupal 9 to Drupal 10 upgrade outline written earlier... Upgrading Drupal 9 to Drupal 10. However, the point of difference is this article works through the actual action steps of the upgrade.
Planning and testing is critical for the Drupal to version 10 process to work successfully. As some of the environments that I work in are deployed via CD/CI pipelines.
Drupal set the private folder
How to set the Private file path in Drupal using the following steps:
- Create a private folder in the web root
- Add a .htaccess file to the private folder
- Update the settings.php file
Exporting a MySQL table to a file
Goal: I want to download a table list to a txt or csv file.
Initially, as a root user I tried using drush
drush sql-dump --tables-list=media_field_data > db-list.sql
Of course as a root user and Drush set-up not as root. failed with
Command 'drush' not found, did you mean:
command 'rush' from deb rush (1.8+dfsg-1.1)
My bad.
Drush open_basedir restriction error
mysql dump FLUSH TABLES access denied
I've recently upgraded the server Ubuntu 20.04 updating the PHP version from 7.4 to 8.1. However, when I've attempted to export the MySQL database using the command
drush sql-dump --extra-dump=--no-tablespaces --result-file=../sql/db-2023-02-25.sql
I seeing the following response
Drupal: how to import the configuration on a different site
After cloning a site, next you will want to import the config file. Which you can do so by running the command:
drush cim -y
Hopefully it worked for you. As it didn't work out so well for me as the response was: