Error message

  • Notice: Trying to access array offset on value of type int in element_children() (line 6600 of /var/www/drupal-7.x/includes/common.inc).
  • Notice: Trying to access array offset on value of type int in element_children() (line 6600 of /var/www/drupal-7.x/includes/common.inc).
  • Notice: Trying to access array offset on value of type int in element_children() (line 6600 of /var/www/drupal-7.x/includes/common.inc).
  • Notice: Trying to access array offset on value of type int in element_children() (line 6600 of /var/www/drupal-7.x/includes/common.inc).
  • Notice: Trying to access array offset on value of type int in element_children() (line 6600 of /var/www/drupal-7.x/includes/common.inc).
  • Notice: Trying to access array offset on value of type int in element_children() (line 6600 of /var/www/drupal-7.x/includes/common.inc).
  • Notice: Trying to access array offset on value of type int in element_children() (line 6600 of /var/www/drupal-7.x/includes/common.inc).
  • Notice: Trying to access array offset on value of type int in element_children() (line 6600 of /var/www/drupal-7.x/includes/common.inc).
  • Notice: Trying to access array offset on value of type int in element_children() (line 6600 of /var/www/drupal-7.x/includes/common.inc).
  • Notice: Trying to access array offset on value of type int in element_children() (line 6600 of /var/www/drupal-7.x/includes/common.inc).
  • Notice: Trying to access array offset on value of type int in element_children() (line 6600 of /var/www/drupal-7.x/includes/common.inc).
  • Notice: Trying to access array offset on value of type int in element_children() (line 6600 of /var/www/drupal-7.x/includes/common.inc).
  • Notice: Trying to access array offset on value of type int in element_children() (line 6600 of /var/www/drupal-7.x/includes/common.inc).
  • Notice: Trying to access array offset on value of type int in element_children() (line 6600 of /var/www/drupal-7.x/includes/common.inc).
  • Notice: Trying to access array offset on value of type int in element_children() (line 6600 of /var/www/drupal-7.x/includes/common.inc).
  • Notice: Trying to access array offset on value of type int in element_children() (line 6600 of /var/www/drupal-7.x/includes/common.inc).
  • Notice: Trying to access array offset on value of type int in element_children() (line 6600 of /var/www/drupal-7.x/includes/common.inc).
  • Notice: Trying to access array offset on value of type int in element_children() (line 6600 of /var/www/drupal-7.x/includes/common.inc).
  • Notice: Trying to access array offset on value of type int in element_children() (line 6600 of /var/www/drupal-7.x/includes/common.inc).
  • Notice: Trying to access array offset on value of type int in element_children() (line 6600 of /var/www/drupal-7.x/includes/common.inc).
  • Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /var/www/drupal-7.x/includes/common.inc).

Sunday, 4 September 2022 - 3:56pm

Published by Matthew Davidson on Sun, 04/09/2022 - 3:56pm in

This fortnight, I have been mostly reading:

Drupal Site Quickstart

Published by Matthew Davidson on Sun, 04/09/2022 - 1:19pm in

Works with Drupal: ^8 || ^9

Create Database and User

mysql -u [user] -p

Where [user] has ALL PRIVILEGES globally

CREATE DATABASE [dbname];
GRANT ALL PRIVILEGES ON [dbname].* TO [dbuser]@localhost IDENTIFIED BY '[password]';
FLUSH PRIVILEGES;

Install Drupal Core from Composer

See Using Composer to Install Drupal and Manage Dependencies.

cd /var/www/
mkdir [dirname]
composer create-project drupal/recommended-project [dirname]

Install Drupal Core from a Git Repo You've Already Created*

* See below.

cd /var/www/
git clone [repo URI]

Rename this directory as required.

cd /var/www/[dirname]
composer i

Configure Apache

Config file template:

<VirtualHost *:80>
        ServerAdmin [you@domain]
        ServerName [fqdn]
        #ServerAlias www.[fqdn]
        
        RewriteEngine on
        RewriteCond  %{HTTP_HOST}  !^[fqdn]          [NC]
        RewriteCond  %{HTTP_HOST}  !^$
        RewriteRule  ^/(.*)        http://[fqdn]/$1  [L,R]

        #Uncomment if production server with HTTPS
        #RewriteCond %{SERVER_NAME} =[fqdn] [OR]
        #RewriteCond %{SERVER_NAME} =[fqdn]
        #RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

  
        DocumentRoot /var/www/[dirname]/web
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/[dirname]/web>
                RewriteEngine on
                RewriteBase /
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteCond %{REQUEST_FILENAME} !-d
                RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        ErrorLog /var/log/apache2/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/apache2/access.log combined
        ServerSignature On

</VirtualHost>

Drupal initial setup

cd /var/www/[dirname]
mkdir -p config/sync
mkdir db
cd /var/www/[dirname]/web/sites/default/
mkdir files
cp default.settings.php settings.php

Set this value in settings.php:

$settings['config_sync_directory'] = '/var/www/[dirname]/config/sync';

Also set trusted hosts.

sudo chown www-data:www-data files/ settings.php

Run Drupal installer

sudo chown [you]:staff settings.php
sudo chmod 664 settings.php
composer require drush/drush drupal/devel drupal/admin_toolbar

See also Drush Launcher.

sudo -u www-data drush en devel admin_toolbar media_library layout_builder

(Running as www-data because media module needs to create a directory in 'files'.)

SSL Certificate

sudo certbot --apache

(On live sites only, obviously.)

[Todo: git stuff.]

Database

Backup

drush sql:dump | gzip > /var/www/[dirname]/db/[whatever].sql.gz

Restore

drush sql:drop
drush sqlq --file=/var/www/[dirname]/[whatever].sql.gz

Sunday, 14 August 2022 - 8:17pm

Published by Matthew Davidson on Sun, 14/08/2022 - 8:17pm in

This week, I have been mostly reading:

Sunday, 7 August 2022 - 9:57pm

Published by Matthew Davidson on Sun, 07/08/2022 - 9:57pm in

This fortnight, I have been mostly working, but when I did get to the pub, I read:

Sunday, 24 July 2022 - 8:20pm

Published by Matthew Davidson on Sun, 24/07/2022 - 8:20pm in

This week, I have been mostly reading comics, cheap gags, and Caitlin Johnstone's incisive rants:

Sunday, 17 July 2022 - 8:23pm

Published by Matthew Davidson on Sun, 17/07/2022 - 4:29pm in

In the reasonably recent past, on the rare occasions when I have not been too tired to find a quiet corner in the pub from which to read off my telephone screen, I was mostly reading:

Sunday, 26 June 2022 - 10:37pm

Published by Matthew Davidson on Sun, 26/06/2022 - 10:37pm in

This week, I have been mostly reading:

Sunday, 19 June 2022 - 6:32pm

Published by Matthew Davidson on Sun, 19/06/2022 - 6:32pm in

This week, I have been mostly reading:

Sunday, 12 June 2022 - 6:52pm

Published by Matthew Davidson on Sun, 12/06/2022 - 6:52pm in

This… Sigh. Here's some stuff to read:

Sunday, 22 May 2022 - 12:31pm

Published by Matthew Davidson on Sun, 22/05/2022 - 12:31pm in

This month, I have been mostly starting my life over from scratch (aka #ThePlan):

Pages