WordPress testing official SQLite Support
github.com
github.com
Since WordPress doesn't have a database abstraction, SQLite integration is done by transforming the SQL query strings meant for MySQL. This not only means doing regexp matches with string replacement, but trying to emulate MySQL functions with either SQLite equivalents, or in the worst case, in PHP application code.
How hard would it be to "add one"/refactor?
From a technical POV: This is potentially straightforward if WordPress leverages (and "blesses", for plug-in developers) a proven abstraction layer like Doctrine DBAL that supports both MySQL and SQLite.
From a non-technical POV: There are tens of thousands of WordPress plug-ins, and even updating the top 1,000 that are good/popular will be a multi-year lift.
MediaWiki technically supports PostgreSQL and SQLite for many years, but extensions are really MySQL focused making it the only real choice.
Behold: https://github.com/WordPress/WordPress/blob/master/wp-includ...
To add one? Trivial.
To refactor all of WP core to use it? I could probably do it in a week or two of focused work.
To enable all plugins and wordpress themes to use it? It is, literally, probably a million times more LOC.
it’s one file — ‘db.php’ — you swap in for the core file. From there, it’s mostly been seamless. ~20% of the 5k LOC, is “Method to emulate MySQL XXX() function.”
Less than that for query parsing, regex & rewrites
https://github.com/aaemnnosttv/wp-sqlite-db/blob/master/src/...
With these edge platforms you really want your DB at the edge with you app code to reduce latency. In fact not doing so can make your app slower due to increased latency on multiple round trips to the DB. SQLite with this type of app is ideal for it, just copy your DB file to the edge VM/Worker any time it changes.
Effectively you move your whole app and DB closer to the user, and being a small embedded sql engine rather than a full server, your edge deployments become very light weight. Makes it possible to have more of them distributed closer to a higher number of users.
In short: for most of Wordpress deployment, especially for long tail of hair salons, car dealerships, personal blogs and other non-tech SME sites
As a post, lmao. It was using its own post type in the wp_posts table and associated post meta table. Barmy.
Talk to someone about how gross this is and they’ll start justifying it to you as “history” and then talk about how cool it is that WordPress was never meant for what it’s used for today but still works. It makes all the managed hosting feel like one big conspiracy.
I can’t tell you how many times I’ve had to optimize raw queries in that stupid framework. Thank god for the rise of SSG and decoupled content management system.
I think the sqLite website does like 200 queries per page view
It's extremely powerful and developer friendly (no more "custom post types" for every record type under the sun), definitely my preferred way to build websites that WordPress would normally handle.
I have to imagine shared web hosts will love this.
But I confess that being able to post a new entry to an API and have it published instantly sure is attractive. If WordPress had a better security track record, I’d be tempted to switch to it. You don’t get much more secure than a bunch of static files served straight from disk, though.
PHP isn’t natively supported there yet, but I can imagine such a thing could be built and be successful.
A lot of people use WordPress for drag'n drop site building. Getting such sites over on Sqlite would increase uptime (less chance of failure withou the separate DB server), reduce support load (easier to move from other providers) and so on.
Alas, compatibility will not be that great with various plugins, so I fear adding SQLite this late will just have the opposite effect.
After the article about running WordPress in the browser was published, there's a new project called WordPress Playground which is gradually preparing NPM or Composer packages to make it easier for people to run it.
https://github.com/WordPress/wordpress-playground/
They've been doing very detailed work, like making some patches to PHP and SQLite for improved compatibility with Emscripten, etc. It seems there's a lot of overlap with what WasmLabs has achieved and probably have continued to develop further. Perhaps there's an opportunity for collaboration.
One thing I'm still trying to suss out is how to have Apache host Wordpress and stuff via HTTP/2. Wordpress which needs PHP which requires mpm_prefork, which precludes mod_http2. Guess I should just proxy WP to another instance of Apache or some other httpd...?
Guess I should take some time this winter to restructure things...
> Wordpress which needs PHP which requires mpm_prefork, which precludes mod_http2. Guess I should just proxy WP to another instance of Apache or some other httpd...?
php-fpm have been de facto method you should host PHP for a decade+. It also allows to have different permissions for web server and PHP app which can make it more secure
IMO Wordpress + SQLite is a no brainer for 90% of sites on internet. I was actually surprised when I discovered the most famous CMS doesn't support SQLite.
People need to stop believing urban legend or stuff that was half-true 15 years ago and test for themselves.