Drupal and php

As of 12 June 2018, Drupal 8 only works with php71. php72 throws a "symfony/polyfill" error. So install php71, then install mod_php71, php71-extensions, and then (sigh) install php71-* as a group: {session,ctype,curl,dom,filter,gd,hash,iconv,json,mbstring,mysqli,openssl,pdo,posix,simplexml,sqlite3,tokenizer,xml,xmlwriter,zlib,pdo_mysql,pdo_sqlite,phar,xmlreader}

Composer settings

Composer is finicky. First, the website should be set to www:www. Then the running user should set his home directory .composer directory to be group www, and change the cache subdirectory to be group- readable. Then run composer commands as sudo -u www.

Composer may hit a memory limit when running. If so, execute the command as "php -d memory_limit=-1 /usr/local/bin/composer ..."

OpenSSL

Mac OS X Server doesn't have OpenSSL installed, but composer won't run without it. So MacPort install phpx, php_select, phpx_openssl, and phpx_mbstring, select the version of php as php, add the bin directory to the front of $PATH, and all will work.

Converting a Drupal site to Composer

First, back up the main site-specific folders elsewhere: sites, modules, themes, profiles. Then delete entire contents of original directory. Run composer create-project, which fills directory with composer-specific files and creates a web subdirectory. Copy the backed-up folders into web. Reset permissions recursively to www:www. Create website entry in apache as a VirtualHost, point to web subfolder. Add DNS entry for site as CNAME to host. Add DNS entry to main DNS provider's records. Set .htaccess. Launch. Run status report and correct any errors.

Setting up a FreeBSD server using a VM

  1. Create a VM.
  2. Download the latest FreeBSD as an .iso image.
  3. Add a CD device to the VM, and point it to the image.
  4. VNC into the VM and reboot.
  5. Follow the installation instructions to create a working FreeBSD system on the VM.
  6. Log into the VM with ssh.
  7. Install (via pkg) bash, emacs-nox11, mutt, postfix, sudo, openntpd.
  8. Change the shell: chsh -s /usr/local/bin/bash.
  9. Set up sudoers in /usr/local/etc/sudoers.

Setting up a BSD server using a jail

  1. Create a jail.
  2. Install emacs-nox11.
    1. Edit .profile to set EDITOR=/usr/local/bin/emacs
    2. Also set PAGER=less
  3. Start a local shell and edit /etc/ssh/sshd_config to enable:
    • Listen 0.0.0.0
    • Port {new port}
  4. Reboot, exit the shell, login remotely.
  5. Install rsync.
    1. Configure /usr/local/etc/rsync/rsyncd.conf.
    2. Enable with sysrc rsyncd_enable="YES"
  6. Install bash.
    1. chsh -s /usr/local/bin/bash robb