php composer, WordPress, and plugins

This entry is part 5 of 5 in the series php features

At the request of a user I configured the Index WP MySQL For Speed plugin to use php’s composer package manager for installation. That plugin has a mu-plugins component because it sometimes needs to intervene in core and plugin updates. Ordinarily, activating it puts the the code into the mu-plugins/ directory. But some WordPress installations … Read more

In php, empty arrays are falsey, not truthy

This entry is part 4 of 5 in the series php features

Maybe I should have known this. But I didn’t, to my detriment. Empty arrays are falsey. Like so. The rule that an empty array is falsey bit me when doing this sort of thing. Many SQL queries can return an empty result set, that is, a result set with zero rows in it. That’s a … Read more

APCu in php — some notes

This entry is part 2 of 5 in the series php features

I’ve been working on the SQLIite Object Cache plugin for WordPress. I’m using the APCu User Cache, php’s RAM cache subsystem, to accelerate cache lookups — specifically to support wp_cache_get() and wp_cache_get_multiple() operations. I’ve had to figure out a few things about this php feature. Here are some notes. Its documentation is not as comprehensive … Read more

Gathering diagnostic data for plugin support

What’s this problem? WordPress plugins run on a variety of sites running on a variety of server configurations, and a variety of other plugins. It’s common for unexpected configurations to cause trouble for plugin users. Then, users open support threads saying “something went wrong.” The plugin authors then need to ask for configuration information to … Read more

ffmpeg Metadata Processing notes

I find myself needing to hack ffmpeg metadata in order to post Gordon Bok’s collection of Kalmyk music. The files ripped by ITunes contain all sorts of metadata. It can be extracted by a command like this and the output looks like this, including a bunch of ITunes-specific metadata items, as well as identifying metadata. … Read more

php’s microtime() function

This entry is part 3 of 5 in the series php features

php’s microtime( true ) function returns a floating point number of seconds since the UNIX epoch. On my computer each call takes about 200ns. The same is true of the time() and hrtime() functions. hrtime() is more modern and gives nanosecond resolution, so use it if possible. It’s available in php 7.3 and beyond. By … Read more

php, Ubuntu, fpm, xdebug, PhpStorm

Here’s an oddity which baffled me and kept me from being able to use xdebug with PhpStorm for a while. I installed a bunch of different versions of php on my Ubuntu VM. I used Ondřej Surý’s repository, rigging my vm to install them like this. To get php5.5, use these commands: Then, I followed … Read more

Counter

Here’s a way to put a counter that updates once a second in a page. It’s based on the time. This isn’t some earth-shattering discovery, it’s trival. But somebody asked me. 123 is the count now!