New location for Apache PHP config

Under PHP 5, I used to put custom PHP configuration in a file such as /etc/php5/apache2/conf.d/99-foobar.ini and it’d be automatically included by the main php.ini (after most others, thanks to the 99).

Now in PHP 7, it seems to be more normal to add a custom module in /etc/php/7.2/mods-available/foobar.ini and enable it with phpenmod foobar. I guess there’s no priority-setting with this system?

MediaWiki with two database servers

I’ve been trying to replicate locally a bug with MediaWiki’s GlobalPreferences extension. The bug is about the increased number of database reads that happen when the extension is loaded, and the increase happens not on the database table that stores the global preferences (as might be expected) but rather on the ‘local’ tables. However, locally I’ve had all of these running on the same database server, which makes it hard to watch the standard monitoring tools to see differences; so, I set things up on two database servers locally.

Firstly, this was a matter of starting a new MySQL server in a Docker container (accessible at 127.0.0.1:3305 and with its data in a local directory so I could destroy and recreate the container as required):

docker run -it -e MYSQL_ROOT_PASSWORD=pwd123 -p3305:3306 -v$PWD/mysqldata:/var/lib/mysql mysql

(Note that because we’re keeping local data, root’s password is only set on the first set-up, and so the MYSQL_ROOT_PASSWORD can be left off future invocations of this command.)

Then it’s a matter of setting up MediaWiki to use the two servers:

$wgLBFactoryConf = [
	'class' => 'LBFactory_Multi',
	'sectionsByDB' => [
		// Map of database names to section names.
		'mediawiki_wiki1' => 's1',
		'wikimeta' => 's2',
	],
	'sectionLoads' => [
		// Map of sections to server-name/load pairs.
		'DEFAULT' => [ 'localdb'  => 0 ],
		's1' => [ 'localdb'  => 0 ],
		's2' => [ 'metadb' => 0 ],
	],
	'hostsByName' => [
		// Map of server-names to IP addresses (and, in this case, ports).
		'localdb' => '127.0.0.1:3306',
		'metadb' => '127.0.0.1:3305',
	],
	'serverTemplate' => [
		'dbname'        => $wgDBname,
		'user'          => $wgDBuser,
		'password'      => $wgDBpassword,
		'type'          => 'mysql',
		'flags'         => DBO_DEFAULT,
		'max lag'       => 30,
	],
];
$wgGlobalPreferencesDB = 'wikimeta';

Upgrading MediaWiki and SMW

I was updating MediaWiki to 1.17 last night, and kept getting a::

  Fatal error: Call to undefined function wfWarn() in /var/www/w/extensions/SemanticMediaWiki/includes/SMW_Setup.php on line 49

because I was setting up SMW with $wgServerName:

  require_once("$IP/extensions/SemanticMediaWiki/SemanticMediaWiki.php");
  enableSemantics($wgServerName);

and this has been deprecated in 1.17. As for why SMW is using the nonexistant mfWarn(), I haven’t got time to investigate.

My xorg.conf

At last we have Ubuntu working with a SGI 1600SW Flatpanel display. Here’s the xorg.conf:

# /etc/X11/xorg.conf (xorg X Window System server configuration file)
#
# This file was generated by dexconf, the Debian X Configuration tool, using
# values from the debconf database.
#
# Edit this file with caution, and see the /etc/X11/xorg.conf manual page.
# (Type "man /etc/X11/xorg.conf" at the shell prompt.)
#
# This file is automatically updated on xserver-xorg package upgrades *only*
# if it has not been modified since the last upgrade of the xserver-xorg
# package.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following commands:
#
#   cp /etc/X11/xorg.conf /etc/X11/xorg.conf.custom
#   sudo sh -c 'md5sum /etc/X11/xorg.conf >/var/lib/xfree86/xorg.conf.md5sum'
#   sudo dpkg-reconfigure xserver-xorg

Section "Files"
	FontPath	"unix/:7100"			# local font server
	# if the local font server has problems, we can fall back on these
	FontPath	"/usr/lib/X11/fonts/misc"
	FontPath	"/usr/lib/X11/fonts/cyrillic"
	FontPath	"/usr/lib/X11/fonts/100dpi/:unscaled"
	FontPath	"/usr/lib/X11/fonts/75dpi/:unscaled"
	FontPath	"/usr/lib/X11/fonts/Type1"
	FontPath	"/usr/lib/X11/fonts/CID"
	FontPath	"/usr/lib/X11/fonts/100dpi"
	FontPath	"/usr/lib/X11/fonts/75dpi"
        # paths to defoma fonts
	FontPath	"/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
	FontPath	"/var/lib/defoma/x-ttcidfont-conf.d/dirs/CID"
EndSection

Section "Module"
	Load	"bitmap"
	Load	"dbe"
	Load	"ddc"
	Load	"dri"
	Load	"extmod"
	Load	"freetype"
	Load	"glx"
	Load	"int10"
	Load	"record"
	Load	"type1"
	Load	"vbe"
EndSection

Section "InputDevice"
	Identifier	"Generic Keyboard"
	Driver		"keyboard"
	Option		"CoreKeyboard"
	Option		"XkbRules"	"xorg"
	Option		"XkbModel"	"pc104"
	Option		"XkbLayout"	"us"
EndSection

Section "InputDevice"
	Identifier	"Configured Mouse"
	Driver		"mouse"
	Option		"CorePointer"
	Option		"Device"		"/dev/input/mice"
	Option		"Protocol"		"ImPS/2"
	Option		"Emulate3Buttons"	"true"
	Option		"ZAxisMapping"		"4 5"
EndSection

Section "Device"
	Identifier	"Number 9 Computer Company Revolution 4"
	Driver		"i128"
	BusID		"PCI:0:10:0"
EndSection

Section "Monitor"
	Identifier	"SGI 1600SW F"
	DisplaySize	370 240
	Option		"DPMS"
	VertRefresh	30-75
	HorizSync	30-70
	VendorName	"SGI"
	UseModes	"Modes0"
EndSection

Section "Modes"
	Identifier "Modes0"
	Modeline "1600x1024d32" 103.125 1600 1600 1656 1664 1024 1024 1029 1030 HSkew 7 +Hsync +Vsync
	Modeline "1600x1024d16" 103.125 1600 1600 1656 1664 1024 1024 1029 1030 HSkew 5 +Hsync +Vsync
EndSection

Section "Screen"
	Identifier	"Default Screen"
	Device		"Number 9 Computer Company Revolution 4"
	Monitor		"SGI 1600SW F"
	DefaultDepth	16
	SubSection "Display"
		Depth		32
		Modes		"1600x1024d32"
	EndSubSection
	SubSection "Display"
		Depth		16
		Modes		"1600x1024d16"
	EndSubSection
	SubSection "Display"
		Depth		8
		Modes		"1600x1024"
	EndSubSection
	SubSection "Display"
		Depth		15
		Modes		"1600x1024"
	EndSubSection
	SubSection "Display"
		Depth		16
		Modes		"1600x1024"
	EndSubSection
	SubSection "Display"
		Depth		24
		Modes		"1600x1024"
	EndSubSection
EndSection

Section "ServerLayout"
	Identifier	"Default Layout"
	Screen		"Default Screen"
	InputDevice	"Generic Keyboard"
	InputDevice	"Configured Mouse"
EndSection

Section "DRI"
	Mode	0666
EndSection