Tag Archives: wordpress

upgrading php on openbsd

First take a snapshot or backup of your server.

Then, we’ll take a backup of our php-fpm.conf file
because if we uninstall php-7.3 it will remove this file too.
doas cp php-fpm.conf php-fpm.conf.bak

Now, let’s stop our instance of php-7.3
doas rcctl stop php-7.3

install php-curl which will pull in php as well.
doas pkg_add -iv php-curl

When presented with a list of php-versions pick php-7.4

Also, install php-zip and pecl74-imagick.
doas pkg_add -iv php-gd php-zip pecl74-imagick

Remember, none of these modules are activated by default by OpenBSD.
In order to activate them, we need to copy them from /etc/php-7.4.sample
directory to /etc/php-7.4

cd /etc/php-.7.4
doas cp ../php-7.4.sample/* .

Now with our files in place and php upgraded, lets edit our
/etc/rc.conf.local file and change php73_fpm to php74_fpm

And we can now start up php74_fpm
doas rcctl start php74_fpm

Refresh our website and make sure WordPress is running fine.

Now we can delete php-7.3
doas pkg_delete -iv php-7.3

This will also remove php-fpm.conf and our site will be broken.
Fortunately we made a backup of this file.
doas mv /etc/php-fpm.conf.bak /etc/php-fpm.conf

Do some file cleanup
doas rm -r /etc/php-7.3 /usr/local/share/php-7.3

Upgrading WordPress on OpenBSD and httpd

When I first setup WordPress on OpenBSD I followed Michael W. Lucas’s book, “Httpd and Relayd”. Actually, this was my first experience ever setting up WordPress on any server. The steps Michael gave made setting it up straightforward. But, when there was an update to WordPress 5.3 yesterday, I felt a bit nervous. I couldn’t find a howto or tutorial on how to upgrade WordPress in a chroot.

httpd on OpenBSD runs in a chroot. I thought this would prove to be a huge problem but it wasn’t too difficult to update.

In addition to Michael’s book mentioned above, the WordPress documentation on doing a manual upgrade was also helpful.

https://wordpress.org/support/article/updating-wordpress/#manual-update

I adapted the above instructions from WordPress’s to the fact that WordPress runs in a chroot on OpenBSD.

To begin with, I downloaded the latest updated stable code from WordPess.

ftp https://wordpress.org/latest.tar.gz

Unpack the gzipped tarball and remove the old wp-includes and wp-admin directories
tar -xzf latest.tar.gz
doas rm -r /var/www/htdocs/wp-includes/ /var/www/htdocs/wp-admin/
Now, update all the files without removing your own content.
doas rsync --update -ra --progress wordpress/ /var/www/htdocs/

All of our fresh files from WordPress are in place. Let’s fix the permissions on those files.

doas chown -R www:www /var/www/htdocs

That’s all I needed to do. I have a simple setup. Your mileage may vary.