Steffen's Knowledge Base

Created at: 2020-08-27 21:15:00
Last modified at: 2024-04-02 22:14:58
Author: Steffen Rick

Drupal wisdoms

Package install
portmaster -ybdv www/apache24 lang/php72 lang/php72-extensions \r
www/mod_php72 databases/mariadb103-server databases/mariadb103-client

# might be necessary to first install the mariadb packages
# php_pdo and php_pdo_mysql necessary. works with the nd driver
Apache PHP config
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>

<FilesMatch "\.php$">
    SetHandler application/x-httpd-php
    </FilesMatch>
<FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source
</FilesMatch>
Composer install
portmaster -ybdv devel/php-composer
Git install
portmaster -ybdv devel/git
Composer site install (drush ships with it)

This goes for drupal 8.7.x, by the looks of it the install instructions have changed yet again with Drupal 8.8.x. What a pity.

composer create-project drupal-composer/drupal-project:8.x-dev site01 --no-interaction
Update from Drupal 8.7.x to 8.8.x
vendor/drush/drush/drush state:set system.maintenance_mode 1   # go into maintenance mode
vendor/drush/drush/drush sql:dump | bzip2 > sqldump.bz2        # to be on the safe side, take db backup
vendor/drush/drush/drush cache:rebuild                         # rebuild the cache
composer update drupal/core --with-dependencies                # update everything that belongs to drupal
composer remove webflo/drupal-core-strict --no-update          # disable webflo, no longer necessary it seems
composer remove drupal/core --no-update                        # disable core, a different template in use now
composer require 'composer/installers:^1.7' --no-update
rm composer.lock                                               # remove previous install settings
rm -rf vendor                                                  # remove vendor software to avoid conflicts
echo 'memory_limit = 2G' > /usr/local/etc/php.ini              # Raise memory limit to 2G, composer requires that much
composer require drupal/core-recommended:^8.8 --update-with-dependencies # the new install template to use
vendor/drush/drush/drush updatedb                              # update database tables
vendor/drush/drush/drush cache:rebuild                         # cache rebuild
vendor/drush/drush/drush state:set system.maintenance_mode 0   # maintenance mode off
vendor/drush/drush/drush cache:rebuild                         # cache rebuild (again)
Install of a module
composer search google                                         # search the module
composer require drupal/google_analytics                       # install the module

Sample files


phpinfo.php in site directory
<?php

// Show all information, defaults to INFO_ALL
phpinfo();

?>
composer.json with local packages
{
    "require": {
        "drush/drush": "^9.7",
        "symfony/polyfill-ctype": "1.11.0",
        "webmozart/assert": "1.4.0",
        "webmozart/path-util": "2.3.0",
        "webflo/drupal-finder": "1.1.0",
        "symfony/yaml": "3.4.28",
        "symfony/polyfill-php72": "1.11.0",
        "symfony/polyfill-mbstring": "1.11.0"
    },
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "symfony/polyfill-ctype",
                "version": "1.11.0",
                "dist": {
                    "url": "/tmp/composer-dist/polyfill-ctype-master.zip",
                    "type": "zip"
                }
            },
            "package": {
                "name": "webmozart/assert",
                "version": "1.4.0",
                "dist": {
                    "url": "/tmp/composer-dist/assert-master.zip",
                    "type": "zip"
                }
            },
        }
    ]
}

Minor update from 8.9.x to 8.9.x
vendor/drush/drush/drush state:set system.maintenance_mode 1   # go into maintenance mode
vendor/drush/drush/drush sql:dump | bzip2 > sqldump.bz2        # to be on the safe side, take db backup

composer update                                                # the update command

vendor/drush/drush/drush updatedb                              # update database tables
vendor/drush/drush/drush state:set system.maintenance_mode 0   # maintenance mode off
vendor/drush/drush/drush cache:rebuild                         # cache rebuild (again)

A Drupal 9 installation with these extensions enabled
PHP version Extension
PHP73 bcmath
PHP73 bz2
PHP73 calendar
PHP73 composer
PHP73 ctype
PHP73 curl
PHP73 dom
PHP73 exif
PHP73 extensions
PHP73 fileinfo
PHP73 filter
PHP73 ftp
PHP73 gd
PHP73 gettext
PHP73 gmp
PHP73 hash
PHP73 iconv
PHP73 intl
PHP73 json
PHP73 ldap
PHP73 mbstring
PHP73 mysqli
PHP73 opcache
PHP73 openssl
PHP73 pcntl
PHP73 pdo
PHP73 pdo_mysql
PHP73 pdo_sqlite
PHP73 pecl-APCu
PHP73 pecl-pdflib
PHP73 pecl-uploadprogress
PHP73 phar
PHP73 posix
PHP73 pspell
PHP73 readline
PHP73 recode
PHP73 session
PHP73 shmop
PHP73 simplexml
PHP73 soap
PHP73 sockets
PHP73 sodium
PHP73 sqlite3
PHP73 tidy
PHP73 tokenizer
PHP73 wddx
PHP73 xml
PHP73 xmlreader
PHP73 xmlrpc
PHP73 xmlwriter
PHP73 xsl
PHP73 zip
PHP73 zlib