Change schema version of a module

For Drupal8+:
Manually setting the current schema version of a module

drush eval "\Drupal::service('update.update_hook_registry')->setInstalledVersion('my_module', 9001);"

Or in this way:

\Drupal::keyValue('system.schema')->set('my_module', (int) 9001);

For Drupal 7:

drush ev "drupal_set_installed_schema_version('my_module', 7025)"


To get installed version for Drupal8+:

Disable cron

Drupal 7:

// Disable drupal's built in cron trigger.
$conf['cron_safe_threshold'] = 0;

Drupal 8/9:

// Disable drupal's built in cron trigger.
$config['automated_cron.settings']['interval'] = 0;

Reset password for the admin user

For Drupal 7
restore admin password

drush sqlq "select name from users where uid=1"

Once you know the name, you can reset the password as follows:

drush upwd admin --password=pass

 

For Drupal 8+

drush user:password site-admin "password"

UPDATE ALL USER PASSWORDS TO ADMIN PASSWORD

drush sql-query "UPDATE users_field_data set pass=(SELECT pass FROM users_field_data where uid=1) WHERE uid <>1"

After this need to clear cache:
drush cr

 

How to Install or Upgrade PHP 8.1 on Ubuntu 20.04

sudo apt install software-properties-common

sudo add-apt-repository ppa:ondrej/php

sudo apt update

sudo apt install php8.1 php8.1-fpm

sudo apt install php8.1-common php8.1-mysql php8.1-xml php8.1-xmlrpc php8.1-curl php8.1-gd php8.1-imagick php8.1-cli php8.1-mbstring php8.1-opcache php8.1-soap php8.1-zip php8.1-intl -y

cd /etc/nginx/sites-available/


sudo touch drupal.conf