Apache - Marcus Povey

02.02.2023

Apache - Marcus Povey

So, ownCloud has been a great way to share files between my different devices for quite some time. I even learned how to make a Minecraft server, which was a lot of fun. It's a PHP application so it's easy to set up.

To run the latest Known code, I updated my server to PHP 7.3. PHP 7.3 is the most recent stable code and should be used by everyone.

This was a problem as ownCloud could only run on PHP versions up to and including 7.2. Although PHP 7.3 will be supported in the next version of ownCloud, release schedules are slow and I needed to get my syncing back on track.

It is possible to use PHP 7.2 on the ownCloud server and PHP 7.3 for all other purposes.

Installing PHP-FPM

This is the most modern way to run PHP, and I was planning on doing it anyway. It's faster, offers more performance options, and, crucially, for my purposes, decouples Apache and PHP so you can run multiple versions.

This is possible on Debian-based servers (mine is Debian with a third-party PHP 7.3 apt repositorie set up).

You will also need to install all the PHP modules (pdo and gd), but that's up to you.

Next, you will need to change your config:

There are two things you should note. First, replace the a2dismod with the current php version. You'll also notice that I didn't enable PHP 7.2 FPM configuration. This is because PHP 7.3 should be the default site, but PHP 7.2 can be enabled on select virtual hosts.

Checking PHPinfo() should now give you something like this:

Note the PHP version number and the Server API.

You'll see PHP 7.3 FPM servers running if you look at your server processes.

Configuring ownCloud's VirtualHost for PHP 7.2

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.

Add the following to your ownCloud virtual host definition

When you run phpinfo() from your ownCloud domain, it should show PHP 7.2!

Now I can resume syncing my files and run the latest PHP version for other domains.

This is a useful feature that can be used to do more than slow software updates. This technique will allow me to run a bleeding-edge PHP version like PHP 7.4 against my development version, Known, and keep my blog running the stable version.

Anyway, I thought it was cool. I hope you find it useful!