So, I’ve been using ownCloud for a while now as a convenient way to share certain files between all of my various devices. The server is a PHP application, so it’s pretty easy to set up.

Anyway, I updated my server to use PHP 7.3, in order to run the latest Known code, among other things. PHP 7.3 is the latest stable code, and so is what everyone should be running, really.

This presented a bit of a problem, as ownCloud would only run on PHP version up to and including 7.2! The next version of ownCloud will apparently support PHP 7.3, however release schedules are slow, and I really needed to get my syncing up and running again.

The obvious solution would be to run PHP 7.2 for the ownCloud server, and then PHP 7.3 for everything else.

Installing PHP-FPM

If you’re running the old school mod_php apache module, the first thing you need to do is install PHP-FPM.

I had been meaning to do this anyway, as this is essentially the modern way of running PHP. It’s faster, gives you many more options for performance, and crucially for my purposes, decouples Apache from PHP meaning you have the option of running multiple versions.

On Debian based servers (mine is Debian, with a third party PHP 7.3 apt repository set up), this turns out to be incredibly easy:

You’ll also want to install all the PHP modules you need (pdo, gd, etc), but I’ll leave that as an exercise for the reader.

Next, you want to switch over your config:

Two things to note here. Firstly, replace the a2dismod statement with whatever php version you currently have installed. Secondly, you’ll notice I didn’t enable the PHP 7.2 FPM config. This is because I want PHP 7.3 to be the default for all sites, but to be able to selectively enable PHP 7.2 on selective virtual hosts.

Checking phpinfo() should now show you something like this:

Note the PHP version and the Server API.

If you look at your server processes, you’ll also see both PHP 7.3 and PHP 7.2 FPM servers running:

Configuring ownCloud’s VirtualHost to use PHP 7.2

So, now you need to modify your ownCloud VirtualHost to use the PHP 7.2 fast CGI server.

Again, this is really really easy, and is pretty much a cut and paste from the php7.2-fpm.conf file you’ll find in your /etc/apache2/conf-available directory.

Place the following somewhere in your ownCloud virtual host definition:

<FilesMatch ".+\.ph(ar|p|tml)$">
SetHandler "proxy:unix:/run/php/php7.2-fpm.sock|fcgi://localhost"

Now, when you run a phpinfo() on your ownCloud domain, you should see it running PHP 7.2!

Now I can get back to syncing my files, while running the latest PHP version for other domains.

This is a useful feature, and obviously can be used to get more than just slow to update software up and running. For a start, this technique will let me run a bleeding edge version of PHP like PHP 7.4 against, for example, my development version of Known, but keep my blog running the stable release.

Anyway, I thought this was cool. Hopefully you’ll find it useful too!

A few of you have been asking about some of the Known dev tools that I use.

Well, I’ve been writing them as I go, and they’re a little bit dotted around, but since moving to composer I’ve been trying to link them up a bit.

Known Dev Scripts

The main dev scripts that I’ve been using are here. Requiring this package will also fetch the language tools scripts and the PHPCS code formatter config.

All of these are already included in the Known checkout in the vendor directory, if you’re checking out from git, and composer installing the dev dependencies (default).

Console Tools

Next are a set of console tools that I’ve built up over time which give me some ability to nudge data around, and to get various dumps of raw data.

They’re dotted around in their own repos, and can be installed individually, but for convenience you can grab them all in one go:

It goes without saying that these should not be installed on a production system – with great power, and all that.


» Visit the project on Github...

In the most recent build of Known, I’ve made some modifications to the developer tool chain that should help us out going forward.

None of this should affect you if you’re just using known, but if you’re a developer it should make things a little bit better.

I’ve switched the SASS compiler to using LibSASS, which is a little bit more “standard” than the ruby one, although doesn’t really affect us yet. But more importantly, javascript compilation is passed through Babel.

Babel is a javascript compiler, which is most widely used to transcode “modern” javascript code written in ES6 so that it can target legacy browsers. Meaning you can write your fancy code, taking advantage of cool stuff, using a version of Javascript that is actually starting to become useful, while still supporting some of the older (yet inexplicably widely installed) browsers out there.

Again, not much is changing right now, but I hope to make much more use of this facility going forward. For a start, Promises are great.

Anyway, hope this is useful!