tech

Upgrading to PHP 7.3 to improve WordPress TTFB

Upgrading to PHP 7.3 to improve WordPress TTFB

This is the hottest summer in Bangkok I can remember having sweated through. So I’m happy to be spending a Sunday afternoon in my air-conditioned home office working through various issues on my main client site in an effort to improve the dreaded Time-To-First-Byte (TTFB) issue. Thinking about it logically, WordPress is the issue here. Given the client’s site is on a VPN and ‘unmanaged’ (that means I manage it) I don’t have to content with troubleshooting the stack – although one of the first tasks I need to undertake today is to upgrade PHP to version 7.3 Firstly it’s…

List active WordPress plugins

List active WordPress plugins

Another win this week. I’ve needed this for some time – a way to list currently active plugins on a WordPress site. I cobbled the following PHP script together from fragments found on the web. You’ll need to edit the IP address at the top of the script. While there are other ways to lock down this script, this is my preferred method.

Here’s the output: (truncated) Click to enlarge Groovy! References Function Reference/get plugins CSS for table styling wprecipes.com -code inspiration

Finally – timestamps in h2o logfile

Finally – timestamps in h2o logfile

This has been bugging the shit out of me for ages and I found a solution today using the ts utility from moreutils. Here’s the error log directive in h2o.conf:

Now I have output which is much more usable. Take a look!

Printing woes – a wise warning on inkjet printers

Printing woes – a wise warning on inkjet printers

I should have listened to the sales guy when he told me you need to use this printer regularly. I didn’t and now my Epson L355 (link to manual) only ‘prints’ blank pages – the print head(s) are well and truly blocked. Just getting the PC talking to the printer was an ordeal. I had previously built a Win 10 VM on Oracle’s Virtualbox and since there are no Linux admin apps for the Epson, I was forced to connect it to a Windows PC to test it out. One thing about Virtualbox – USB don’t work ‘out of the…

The sun sets on Shashin

The sun sets on Shashin

It appears the popular Shashin WordPress plugin is no more. Although its developer Mike Toppa stopped supporting the plugin a number of years ago, it has now been pulled from the WP plugin repository and usage documentation seems to have disappeared. No surprise really, as Google has been slowly but surely killing the integration with Picasa after launching Google Photos (Google acquired Picasa in 2004). I’ve blogged about Picasa pain before. http://www.craigamos.rocks/picasa-pain-persisits/ http://www.craigamos.rocks/google-photos/ Additionally, the Picasa desktop application no longer works. Where does that leave the existing user base? The plugin still works for existing Google albums, at least. You…

Tuning fpm-php: Not for the faint of heart

Tuning fpm-php: Not for the faint of heart

Another tech Sunday – they never get old 🙂 This is a somewhat long and boring post. More of a tech journal entry. But who knows, maybe someone else will find it interesting. First let’s backtrack a little – what is CGI you ask? source: https://www.irt.org/articles/js184/ An acronym for Common Gateway Interface, CGI was the first implementation of a server-side ‘gateway’ where http could interact with external applications such as databases. Although CGI is language agnostic, typically PERL scripts were used. CGI is rarely used today due to inherent security vulnerabilities. Then there’s fastcgi And then there’s php-fpm (FastCGI process…

Sunday’s are for schemacrawling

Sunday’s are for schemacrawling

I love looking at database schema diagrams – and last Sunday I came across Schemacrawler. Getting it up and running all went pretty smoothly. I downloaded the zip file from here You also need to install GrahpViz. References: http://www.schemacrawler.com/diagramming.html Output your database schema To output a pdf of the schema:

To output a png of the schema:

A rainy saturday spent with SQLite

A rainy saturday spent with SQLite

I’d been meaning to get my mits on SQLite for some time and finally found a good project to do so. Installing SQLite I’m on ubuntu so the following got things sorted for me:

I then noticed I was getting the following 

I needed to install the following as per this post and restart my web server

Check SQLite is installed

Finally, some working php code While I won’t share my production code with you, here’s what I can share References: https://www.tutorialspoint.com/sqlite/sqlite_php.htm https://www.digitalocean.com/community/tutorials/how-and-when-to-use-sqlite As per the tutorial above, I created the WINES table and populated it:…

VNC to the rescue

VNC to the rescue

Had a little problem – needed to download some rather large files which would have blown my data allowance, and the clock was ticking, so thought it a good idea to download them to my webhost. Slight problem, though, I needed a browser so I could access the files from links sent to my email (files from Google Takeout so WGET/CURL didn’t seem like an option – I tried WGET to no avail) Here’s how I achieved it: 1) Installed Openbox and X server components to my host (Ubuntu based)

Then I needed

2) Tried to start x…

Monday WordPress Woes

Monday WordPress Woes

I picked the wrong day to give up sniffing glue! Been building a new WordPress site and I was trying to migrate it to a new domain when something went very wrong. I had a backup before you ask, but when I tried to restore it, things went tits up Here are the results of the MySQL CLI alchemy: (edited to just show errors)

It’s not as bad as it looks; there are two errors basically • Attempted insert of string with 4-byte value fails • Invalid default value. This turns out to be a date value of '0000-00-00 00:00:00'

1 of 5
12345