Trusting Your Own Authority
When migrating the pestilence that is Wordpress to a new server, it's sometimes handy to use a virtual host with the same domain name, to avoid the mess that otherwise splashes on your shoes when Wordpress inevitably tries to reference it's embedded domain settings. While faking the DNS is easy, faking SSL not so much.

The issue we sometimes face is that we're required to extract or otherwise extricate a Wordpress install from a borked host, or other unsatisfactory provider and restore it on to a new server. We don't always have control of the DNS at this time, since it's a data recovery exercise.

Unfortunately, Wordpress has a habit of saving the domain that it's running on through the database. Yes, you can change it in the dashboard config, or hard code it in the wp-config file, but you will still find places where the exceptionally poor data model that Wordpress' database uses stores serialised data including domain in the database.

Add to that the fact that most if not all permalinks are full URLs, not relative, and you've got a problem. The simplest way out of this then is to make sure the virtual host you're running it on matches the original. Changing the DNS via the hosts file is the simple part, but these days most sites use SSL and that can be a lot more fun particularly if you don't yet have the ability to generate a free SSL certificate or control the actual DNS to generate a domain validated certificate.

How to solve this issue then? Become your own Certificate Authority!

Posted 15/10/22

Read more »

Compiing PHP 5.6.40 on Ubuntu 18.04
Compiling PHP 5.6.40 on Ubuntu 18.04 isn't as straight forward as 16.04. In particular there are issues with CURL and OpenSSL

CURL libraries are not found

The fix here is NOT to symbolic link the /usr/include/x86_64-linux-gnu/curl  folder to /usr/include/curl. Doing that will make it compile for sure, but when you try and actually use the curl_exec function, PHP will segfault.

The solution that worked for me was to grab a copy of the curl source, and compile that and install into /opt/usr/local. I went with a version that was a similar age to PHP 5.6. Later versions might work too. YMMV.

./configure --with-ssl=/opt/usr/local/ --prefix=/opt/usr/local

Once that's done, use the PHP configure option:

Posted 06/07/19

Read more »

Anything but Wordpress
Why Wordpress is Not a Good Solution For Anything Except a Simple Blog

So what's wrong with Wordpress?


If you search for arguments for and against the Wordpress blogging platform, you will find a vast number of results, some that will tell you it's the best thing since sliced bread, and others that will say that it's the most dire and insecure platform there is.

Wordpress has been around for a long time. It started life back in 2001 as a package called b2 cafelog, and being open source, was forked in 2003 to create Wordpress. It was and still is a tool for writing a blog. It's often referred to as a Content Management System, but it isn't. It's a blogging tool. It has become the darling of the graphic design, branding and advertising agencies largely because of its sheer ubiquity and the huge range of themes and templates that are available for it. Such companies often treat websites as an afterthought of the branding exercise and tend not to have full time software developers available and rely on the point/click method of development that a lot of Wordpress themes provide. Such companies generally don't have much of a clue about security or an idea of the necessity of keeping sites up to date and it's no surprise that they end up getting hacked, defaced or serve up malware.

Among Wordpress's  problems are:


Posted 04/11/17

Read more »

Overriding concrete 5.7 Core Service
concrete 5.7 replaces helpers with services. It's a little tricky to override these, but not when you know how.

I had occassion recently to use concrete5's mail helper to sent a message with an attachment. Although there is an addAttachment() method, it expects a file object to be passed to it. Unfortunately that means that the file has to exist within the file manager. In my case, I was wanting to send the invoice I'd just pushed into Xero, something that Xero cannot do with its API. Writing the file to disk and importing it into the file manager seemed like far too much overhead, not to mention clagging up the file manager with extraneous files. Here's how I got around it without modifying the concrete5 core.

Posted 28/12/16

Read more »

Scrubbing Away Microsoft Smart Quotes
Microsoft "smart" quotes can be anything but. Let's scrub them clean with a little Vim.

I tend to do a lot of data mangling. Occasionally I trip over text that has been tainted with Microsoft Office and is infested with their so-called "Smart" quotes. These little nasties tend not to play nice with some importers. Fortunately, they can be scrubbed clean with a little Vim

Posted 04/05/16

Read more »