Let’s make WordPress officially support SQLite

<div style&equals;"text-align&colon;center"><img src&equals;"data&colon;image&sol;gif&semi;base64&comma;R0lGODlhAQABAIAAAAAAAP&sol;&sol;&sol;ywAAAAAAQABAAACAUwAOw&equals;&equals;" fifu-lazy&equals;"1" fifu-data-sizes&equals;"auto" fifu-data-srcset&equals;"https&colon;&sol;&sol;i1&period;wp&period;com&sol;www&period;awordpresscommenter&period;com&sol;wp-content&sol;uploads&sol;2022&sol;09&sol;lets-make-wordpress-officially-support-sqlite&period;png&quest;ssl&equals;1&w&equals;75&resize&equals;75&ssl&equals;1 75w&comma; https&colon;&sol;&sol;i1&period;wp&period;com&sol;www&period;awordpresscommenter&period;com&sol;wp-content&sol;uploads&sol;2022&sol;09&sol;lets-make-wordpress-officially-support-sqlite&period;png&quest;ssl&equals;1&w&equals;100&resize&equals;100&ssl&equals;1 100w&comma; https&colon;&sol;&sol;i1&period;wp&period;com&sol;www&period;awordpresscommenter&period;com&sol;wp-content&sol;uploads&sol;2022&sol;09&sol;lets-make-wordpress-officially-support-sqlite&period;png&quest;ssl&equals;1&w&equals;150&resize&equals;150&ssl&equals;1 150w&comma; https&colon;&sol;&sol;i1&period;wp&period;com&sol;www&period;awordpresscommenter&period;com&sol;wp-content&sol;uploads&sol;2022&sol;09&sol;lets-make-wordpress-officially-support-sqlite&period;png&quest;ssl&equals;1&w&equals;240&resize&equals;240&ssl&equals;1 240w&comma; https&colon;&sol;&sol;i1&period;wp&period;com&sol;www&period;awordpresscommenter&period;com&sol;wp-content&sol;uploads&sol;2022&sol;09&sol;lets-make-wordpress-officially-support-sqlite&period;png&quest;ssl&equals;1&w&equals;320&resize&equals;320&ssl&equals;1 320w&comma; https&colon;&sol;&sol;i1&period;wp&period;com&sol;www&period;awordpresscommenter&period;com&sol;wp-content&sol;uploads&sol;2022&sol;09&sol;lets-make-wordpress-officially-support-sqlite&period;png&quest;ssl&equals;1&w&equals;500&resize&equals;500&ssl&equals;1 500w&comma; https&colon;&sol;&sol;i1&period;wp&period;com&sol;www&period;awordpresscommenter&period;com&sol;wp-content&sol;uploads&sol;2022&sol;09&sol;lets-make-wordpress-officially-support-sqlite&period;png&quest;ssl&equals;1&w&equals;640&resize&equals;640&ssl&equals;1 640w&comma; https&colon;&sol;&sol;i1&period;wp&period;com&sol;www&period;awordpresscommenter&period;com&sol;wp-content&sol;uploads&sol;2022&sol;09&sol;lets-make-wordpress-officially-support-sqlite&period;png&quest;ssl&equals;1&w&equals;800&resize&equals;800&ssl&equals;1 800w&comma; https&colon;&sol;&sol;i1&period;wp&period;com&sol;www&period;awordpresscommenter&period;com&sol;wp-content&sol;uploads&sol;2022&sol;09&sol;lets-make-wordpress-officially-support-sqlite&period;png&quest;ssl&equals;1&w&equals;1024&resize&equals;1024&ssl&equals;1 1024w&comma; https&colon;&sol;&sol;i1&period;wp&period;com&sol;www&period;awordpresscommenter&period;com&sol;wp-content&sol;uploads&sol;2022&sol;09&sol;lets-make-wordpress-officially-support-sqlite&period;png&quest;ssl&equals;1&w&equals;1280&resize&equals;1280&ssl&equals;1 1280w&comma; https&colon;&sol;&sol;i1&period;wp&period;com&sol;www&period;awordpresscommenter&period;com&sol;wp-content&sol;uploads&sol;2022&sol;09&sol;lets-make-wordpress-officially-support-sqlite&period;png&quest;ssl&equals;1&w&equals;1600&resize&equals;1600&ssl&equals;1 1600w" width&equals;"1200" height&equals;"600" fifu-data-src&equals;"https&colon;&sol;&sol;i1&period;wp&period;com&sol;www&period;awordpresscommenter&period;com&sol;wp-content&sol;uploads&sol;2022&sol;09&sol;lets-make-wordpress-officially-support-sqlite&period;png&quest;ssl&equals;1" class&equals;"attachment-post-thumbnail size-post-thumbnail wp-post-image" alt&equals;"Let’s make WordPress officially support SQLite" title&equals;"Let’s make WordPress officially support SQLite" srcset&equals;"https&colon;&sol;&sol;i1&period;wp&period;com&sol;www&period;awordpresscommenter&period;com&sol;wp-content&sol;uploads&sol;2022&sol;09&sol;lets-make-wordpress-officially-support-sqlite&period;png&quest;ssl&equals;1 1200w&comma; https&colon;&sol;&sol;www&period;awordpresscommenter&period;com&sol;wp-content&sol;uploads&sol;2022&sol;09&sol;lets-make-wordpress-officially-support-sqlite-300x150&period;png 300w&comma; https&colon;&sol;&sol;www&period;awordpresscommenter&period;com&sol;wp-content&sol;uploads&sol;2022&sol;09&sol;lets-make-wordpress-officially-support-sqlite-1024x512&period;png 1024w&comma; https&colon;&sol;&sol;www&period;awordpresscommenter&period;com&sol;wp-content&sol;uploads&sol;2022&sol;09&sol;lets-make-wordpress-officially-support-sqlite-768x384&period;png 768w" sizes&equals;"&lpar;max-width&colon; 1200px&rpar; 100vw&comma; 1200px" &sol;><&sol;div><div>&NewLine;<p>WordPress can be &lpar;and is&rpar; used for any kind of site&comma; regardless of size or complexity&period; Some common use-cases include&colon;<&sol;p>&NewLine;<ul>&NewLine;<li>Single-page landing sites<&sol;li>&NewLine;<li>Simple company sites with just a few pages&period; These sites are usually rarely updated and are essentially static sites with an administration aspect&period;<&sol;li>&NewLine;<li>Simple&comma; single-user blogs<&sol;li>&NewLine;<li>Complex news sites<&sol;li>&NewLine;<li>e-Commerce sites<&sol;li>&NewLine;<li>Full-fledged CMS solutions<&sol;li>&NewLine;<&sol;ul>&NewLine;<p>Part of the success of WordPress is because it is extendable&comma; hookable&comma; and can be used and tweaked to accomplish almost any task on the web&period;<&sol;p>&NewLine;<p>However&comma; one aspect of WordPress has never changed&comma; regardless of the increase in WP’s use cases and popularity&colon; The database&period; WordPress requires MySQL&sol;MariaDB to be installed on a site&period; MySQL is arguably only optimal for some of the scenarios&colon; The &OpenCurlyDoubleQuote;mid-tier” range of site types&period;<&sol;p>&NewLine;<p>Large sites usually implement custom database stacks depending on their specific needs&comma; so are beyond the scope of this proposal&period;<&sol;p>&NewLine;<p>On the lower end of the spectrum&comma; there are small and simple sites&period; These are numerous and consist of all the blogs&comma; company pages&comma; and sites that don’t have thousands of users or thousands of posts&comma; etc&period; These websites don’t always need the complexities of a MySQL&sol;MariaDB database&period; The requirement of a dedicated MySQL server increases their hosting cost and the complexity of installation&period; On lower-end servers&comma; it also decreases performance since the same &OpenCurlyDoubleQuote;box” needs to cater to both a PHP and a MySQL&sol;MariaDB server&period;<&sol;p>&NewLine;<h2>The ideal scenario<&sol;h2>&NewLine;<p>Ideally&comma; WordPress would allow us to choose the type of database during installation&period; That could be done using an installation guide&comma; or a simple constant in wp-config&period;php&period; To accomplish that&comma; WordPress would need to have a database-abstraction layer&period; This is not an innovative or radical idea in the CMS space&semi; Drupal has had a solid database-abstraction layer for more than a decade&period; Laravel&comma; Symfony&comma; and others also include ORMs that allow using multiple database types&period;<&sol;p>&NewLine;<p>Building a database abstraction layer for WordPress would be a colossal task – though it might be one that&comma; at some point in the future&comma; we may have to undertake to ensure the project’s continued evolution and longevity&period;<&sol;p>&NewLine;<h2>A middle ground<&sol;h2>&NewLine;<p>As a middle ground&comma; we could implement a solution for the bottom tier&colon; small to medium sites and blogs&period; These sites don’t necessarily need a full-fledged MySQL database&period;<&sol;p>&NewLine;<p>SQLite seems to be the perfect fit&colon;<&sol;p>&NewLine;<ul>&NewLine;<li>It is the most widely used database worldwide<&sol;li>&NewLine;<li>It is cross-platform and can run on any device<&sol;li>&NewLine;<li>It is included by default on all PHP installations &lpar;unless explicitly disabled&rpar;<&sol;li>&NewLine;<li>WordPress’s minimum requirements would be a simple PHP server&comma; without the need for a separate database server&period; <&sol;li>&NewLine;<li>SQLite support enables lower hosting costs&comma; decreases energy consumption&comma; and lowers performance costs on lower-end servers&period;<&sol;li>&NewLine;<&sol;ul>&NewLine;<h2>Implementing SQLite in WordPress Core<&sol;h2>&NewLine;<p>Using SQLite in WordPress is&comma; at this point&comma; simple&semi; There are implementations out there that have been around and evolving for more than 8 years&period; They have been thoroughly tested and proved to work seamlessly&period; These implementations are drop-in <code>wp-content&sol;db&period;php<&sol;code> files that users can add to their installation&semi; they are not hard to use&period; <&sol;p>&NewLine;<p>However&comma; most people are not aware of them&period; They are not aware that they have the option to buy cheaper hosting sans-mysql and then install WordPress using an SQLite database&period; Nor should they have to know about it… After all&comma; they just want a simple company site or a blog&period; <&sol;p>&NewLine;<p>WordPress could officially support SQLite by including one of the existing SQLite implementations in Core&period; We would need to ensure that it is properly tested and supported&comma; and additionally&comma; raise awareness and expose the option to users&period;<&sol;p>&NewLine;<h2>Why should this be in Core and not a plugin&quest; <&sol;h2>&NewLine;<p>Picking a database type is something that should happen when a site is first installed&period; It is not something that should be done after the fact because that would require migrating data from one database to another&comma; which can often be complex&period; <&sol;p>&NewLine;<p>WordPress includes the MySQL implementation in Core&comma; so if we support SQLite then that implementation should live alongside it&period; <&sol;p>&NewLine;<p>Data migration can &lpar;and should&rpar; be in a plugin to facilitate migrations for existing sites should they wish to do that&comma; but the database engine itself belongs in Core&period; <&sol;p>&NewLine;<p>That will ensure that the implementation is properly supported&comma; properly tested&comma; and WordPress will be able to benefit&comma; as detailed in the following section&period;<&sol;p>&NewLine;<h2>What would the benefits of SQLite be&quest;<&sol;h2>&NewLine;<p>Officially supporting SQLite in WordPress could have many benefits&period; Some notable ones would include&colon;<&sol;p>&NewLine;<ul>&NewLine;<li>Increased performance on lower-end servers and environments&period;<&sol;li>&NewLine;<li>Potential for WordPress growth in markets where we did not have access due to the system’s requirements&period;<&sol;li>&NewLine;<li>Potential for growth in the hosting market using installation &OpenCurlyDoubleQuote;scenarios”&period;<&sol;li>&NewLine;<li>Reduced energy consumption – increased sustainability for the WordPress project&period;<&sol;li>&NewLine;<li>Further WordPress’s mission to &OpenCurlyDoubleQuote;democratize publishing” for everyone&period;<&sol;li>&NewLine;<li>Easier to contribute to WordPress – download the files and run the built-in PHP server without any other setup required&period;<&sol;li>&NewLine;<li>Easier to use automated tests suite&period;<&sol;li>&NewLine;<li>Sites can be &OpenCurlyDoubleQuote;portable” and self-contained&period;<&sol;li>&NewLine;<&sol;ul>&NewLine;<h2>Next steps<&sol;h2>&NewLine;<p>The next steps would need to be discussed in the comments section of this proposal&period; If there is consensus to implement SQLite in WordPress Core&comma; an outline of the next steps would look something like this&colon;<&sol;p>&NewLine;<ul>&NewLine;<li>Create the necessary Trac tickets<&sol;li>&NewLine;<&sol;ul>&NewLine;<ul>&NewLine;<li>Decide how the database type would be defined&period; The most simple scenario would be a <code>DATABASE&lowbar;TYPE<&sol;code> constant in <code>wp-config&period;php<&sol;code>&comma; allowing users to choose if their new site would use a MySQL or SQLite database&comma; but there can be other solutions that come up during a later discussion&period;<&sol;li>&NewLine;<li>Port an SQLite implementation to WordPress Core&comma; applying the necessary changes like coding standards&comma; in-code documentation&comma; migrate tests&comma; etc&period;<&sol;li>&NewLine;<li>Test WordPress Core functionality with SQLite<&sol;li>&NewLine;<li>Outreach to plugin developers for testing&period;<&sol;li>&NewLine;<&sol;ul>&NewLine;<p><em>The subject of database abstractions and using SQLite was discussed at length during WCEU 2022&comma; in an unofficial capacity&comma; in the hallways&period; This post is a distilled culmination of these conversations to bring the discussion to the broader community for serious consideration&period;<&sol;em><&sol;p>&NewLine;<p>Props <a href&equals;"https&colon;&sol;&sol;profiles&period;wordpress&period;org&sol;zieladam&sol;" class&equals;"mention"><span class&equals;"mentions-prefix">&commat;<&sol;span>zieladam<&sol;a>&comma; <a href&equals;"https&colon;&sol;&sol;profiles&period;wordpress&period;org&sol;mamaduka&sol;" class&equals;"mention"><span class&equals;"mentions-prefix">&commat;<&sol;span>mamaduka<&sol;a>&comma; <a href&equals;"https&colon;&sol;&sol;profiles&period;wordpress&period;org&sol;jonoaldersonwp&sol;" class&equals;"mention"><span class&equals;"mentions-prefix">&commat;<&sol;span>jonoaldersonwp<&sol;a>&comma; <a href&equals;"https&colon;&sol;&sol;profiles&period;wordpress&period;org&sol;tweetythierry&sol;" class&equals;"mention"><span class&equals;"mentions-prefix">&commat;<&sol;span>tweetythierry<&sol;a>&comma; <a href&equals;"https&colon;&sol;&sol;profiles&period;wordpress&period;org&sol;sergeybiryukov&sol;" class&equals;"mention"><span class&equals;"mentions-prefix">&commat;<&sol;span>SergeyBiryukov<&sol;a>&comma; <a href&equals;"https&colon;&sol;&sol;profiles&period;wordpress&period;org&sol;joostdevalk&sol;" class&equals;"mention"><span class&equals;"mentions-prefix">&commat;<&sol;span>joostdevalk<&sol;a>&comma; <a href&equals;"https&colon;&sol;&sol;profiles&period;wordpress&period;org&sol;dingo&lowbar;d&sol;" class&equals;"mention"><span class&equals;"mentions-prefix">&commat;<&sol;span>dingo&lowbar;d<&sol;a>&comma; <a href&equals;"https&colon;&sol;&sol;profiles&period;wordpress&period;org&sol;desmith&sol;" class&equals;"mention"><span class&equals;"mentions-prefix">&commat;<&sol;span>desmith<&sol;a>&comma; <a href&equals;"https&colon;&sol;&sol;profiles&period;wordpress&period;org&sol;crixu&sol;" class&equals;"mention"><span class&equals;"mentions-prefix">&commat;<&sol;span>crixu<&sol;a>&comma; <a href&equals;"https&colon;&sol;&sol;profiles&period;wordpress&period;org&sol;williampatton&sol;" class&equals;"mention"><span class&equals;"mentions-prefix">&commat;<&sol;span>williampatton<&sol;a>&comma; <a href&equals;"https&colon;&sol;&sol;profiles&period;wordpress&period;org&sol;costdev&sol;" class&equals;"mention"><span class&equals;"mentions-prefix">&commat;<&sol;span>costdev<&sol;a>&comma; <a href&equals;"https&colon;&sol;&sol;profiles&period;wordpress&period;org&sol;adamsilverstein&sol;" class&equals;"mention"><span class&equals;"mentions-prefix">&commat;<&sol;span>adamsilverstein<&sol;a>&comma; <a href&equals;"https&colon;&sol;&sol;profiles&period;wordpress&period;org&sol;javiercasares&sol;" class&equals;"mention"><span class&equals;"mentions-prefix">&commat;<&sol;span>JavierCasares<&sol;a>&comma; <a href&equals;"https&colon;&sol;&sol;profiles&period;wordpress&period;org&sol;robinwpdeveloper&sol;" class&equals;"mention"><span class&equals;"mentions-prefix">&commat;<&sol;span>robinwpdeveloper<&sol;a>&comma; <a href&equals;"https&colon;&sol;&sol;profiles&period;wordpress&period;org&sol;aaemnnosttv&sol;" class&equals;"mention"><span class&equals;"mentions-prefix">&commat;<&sol;span>aaemnnosttv<&sol;a>&comma; <a href&equals;"https&colon;&sol;&sol;profiles&period;wordpress&period;org&sol;jessibelle&sol;" class&equals;"mention"><span class&equals;"mentions-prefix">&commat;<&sol;span>jessibelle<&sol;a> for reviewing and contributing to this proposal&period;<&sol;p>&NewLine;<p class&equals;"o2-appended-tags"><a href&equals;"https&colon;&sol;&sol;make&period;wordpress&period;org&sol;core&sol;tag&sol;database&sol;" class&equals;"tag"><span class&equals;"tag-prefix">&num;<&sol;span>database<&sol;a>&comma; <a href&equals;"https&colon;&sol;&sol;make&period;wordpress&period;org&sol;core&sol;tag&sol;install&sol;" class&equals;"tag"><span class&equals;"tag-prefix">&num;<&sol;span>install<&sol;a>&comma; <a href&equals;"https&colon;&sol;&sol;make&period;wordpress&period;org&sol;core&sol;tag&sol;performance&sol;" class&equals;"tag"><span class&equals;"tag-prefix">&num;<&sol;span>performance<&sol;a>&comma; <a href&equals;"https&colon;&sol;&sol;make&period;wordpress&period;org&sol;core&sol;tag&sol;sustainability&sol;" class&equals;"tag"><span class&equals;"tag-prefix">&num;<&sol;span>sustainability<&sol;a><&sol;p>&NewLine;<&sol;div>&NewLine;

Sponsored
Sponsored
A WordPress Commenter

Recent Posts

Judge Reins In Discovery Fight as WP Engine Ordered to Produce Customer Data

A U.S. magistrate judge has moved to rein in the escalating discovery battle between WP…

1 day ago

Ollie’s Menu Designer Flagged for Core, With Automattic Developers Set to Help Shepherd It

Ollie’s “game-changing” Menu Designer plugin is moving toward inclusion in WordPress core. Anne McCarthy says…

5 days ago

WordPress.com Rolls Out MCP Support as Automattic Dogfoods MCP Adapter

WordPress.com has rolled out support for the Model Context Protocol (MCP), allowing AI assistants to…

6 days ago

First Ten Hosts Certified Under Secure Hosting Alliance’s Trust Seal Program

Ten hosting providers have been certified under the Secure Hosting Alliance’s new Trust Seal program,…

6 days ago

Chasing the Sun: Inside WP Accessibility Day’s 24-Hour Event & What to Expect in 2025

When WP Accessibility Day kicks off next week, someone, somewhere will always be awake. As…

6 days ago

Performance Chat Summary: 7 October 2025

The full chat log is available beginning here on Slack. WordPress Performance Trac tickets @westonruter…

1 week ago