A blog about DevOps, PHP, WordPress and more!

Running ls on a folder with many files or folders in it (>20 000) can take minutes or even hours. To speed up the process you can combine the unsorted output of ls (which is fast) with the sort command, like this:

There’s not a lot of information about DiskCryptor and Windows 10 online. Development of DC has stalled a bit but it’s still a very stable and useful piece of software. Here are answers to some common questions:

Does DiskCryptor work with Windows 10?

Yes, DiskCryptor works with all versions of Windows 10 including the Anniversary Update. (At the moment of writing this blog post, the latest build number is 14393 / 1607.)

Does DiskCryptor work with ReFS filesystems?

Yes, DiskCryptor works with ReFS filesystems.

Does DiskCryptor work with storage spaces?

Yes, DiskCryptor works with Windows Storage Spaces. I have also tried to physically move a storage space from one PC to another while encrypted, and it works just fine on the new computer as well.

DiskCryptor running on a storage space that uses ReFS.

Does DiskCryptor work with the software RAID in Windows 10?

Yes.

Can you boot from an ReFS filesystem when using DiskCryptor?

No, but Windows 10 doesn’t support booting from ReFS disks, so it’s not a DC issue.

Will DiskCryptor work when rebooting to do an update?

Generally – yes. Some of the biggest Windows updates (like the Anniversary Update) might give you issues. It rarely leads to a serious problem other than the computer booting into troubleshooting mode and typically you can just reboot again and Windows will revert any attempted updates.

However, fixing this is trivial. Simply decrypt your boot drive first, and then apply the update. You can then encrypt your drive again once the update is installed. Note that this is only required on the boot drive, not any other drives attached to the system. Typically you also don’t have to uninstall the bootloader, but you can do so if you wish via Tools > Config bootloader.

After building a project using Composer, you might ask yourself what the lowest supported PHP version amongst all the included libraries is. The highest number would also be the the minimum version PHP version that the project would run on.

Made a quick plugin for adding multi-currency support to Polylang. It is primarily designed for use with Polylang for WooCommerce, but it should work fine with the Hyyan WooCommerce Polylang Integration as well.

I recently got a Gl.Inet 6416 router off AliExpress for about $25. It’s an interesting little box that includes many features that routers ten times more expensive lack. (Thanks OpenWRT and open source!) The box is powered by the Atheros AR9331, an aging MIPS architecture processor clocked at a measly 400mhz with 64MB of RAM and 16MB of storage. In computer years, MIPS is stone-age technology, first launched in 1981(!), and the MIPS 24K standard this particular processor implements was first launched in 2004.

But the router is still quite capable even by 2016 standards! There is an SSH server and a package manager, opkg, which has packages for PHP 5.6. I immediately thought of something crazy to do – namely to install WordPress on this poor little machine.

So let’s see how that works.

Scaling things down

64MB of memory can’t accomodate either Apache or MySQL, so we have to find a way to run without them. Luckily, PHP has a built-in web server since version 5.4 that we can use, and WordPress has a SQLite plugin. This is a truly cool plugin that hooks into the db.phpdrop-ins and dynamically rewrites all WordPress database calls from MySQL to SQLite-compatible syntax.

Increasing the storage

16 MB of internal storage won’t get us far. Luckily, you can insert a USB drive and it happily mounts it under /mnt/sda1, so let’s do that:

Installing dependencies

Let’s SSH into the router and install SQLite, PHP and some useful tools like wget…

Some PHP defaults aren’t a good fit for this ancient architecture. Let’s decrease opcache.memory_consumption from 64MB to 8MB and increase the max_execution_time from 30 to 300 in /etc/php.ini

Booting it up

Now let’s finally start this baby up on the built-in PHP web server:

cd wordpress
php-cli -S 0.0.0.0:8080

Loading up the browser the router IP on port 8080 gives us a familiar sight:

http://192.168.8.1:8080

Thanks to the SQLite adapter, we don’t need to provide database credential, an on-disk database has already been created for us in wordpress/wp-content/database/.ht.sqlite.

After about 40 seconds, the install finally finishes!

So what’s the speed like?

It comes as no surprise that this is suh-low! A pageload takes 5-15 seconds. Sometimes even longer if you are saving a draft or publishing a post:

Other than that, it does actually run! Although uploading large images tends to make the built-in server crash with an out-of-memory error. Not surprising, considering we only have about 40 MB of RAM to play with (The operating system takes up approximately 25MB RAM).

Conclusion

Even though this is a silly project it shows that it is not only possible to run WordPress on OpenWRT, but that it is fairly pain-free to set up. There are more powerful MIPS processors out there (like the Qulcomm QCA9531 with 650mhz/128MB RAM) and those might actually make this usable for a real site. Hope you learned about some techniques to use WordPress in low-memory environments!