You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been looking at the code in the plugin's activation function. I'm wondering if there's some way to perform the same steps manually to get the sqlite support configured before initializing WP for the first time.
Note that I had to manually make the changes @jeff-cannapress mentioned to db.php before copying it into the image. The environment variables are needed so the setup doesn't prompt you for MySQL connection info, but otherwise are not used.
If the authors of the patch feel like things are stable enough and folks are interested in testing it out via Docker, I'd be happy to publish the image.
As long as SQLite is in the form of a plugin, there is no straight-forward way to setup a new site without using MySQL - unless you manually go through the steps in the original post.
I do keep a branch of WP with SQLite integration if you would like to test that though... You can find it in WordPress/wordpress-develop#3220 and it basically integrates the classes and functions from this plugin, as well as add some changes to the install screen to make it easy to actually install a new WP site using SQLite 👍
@aristath TBH with the Dockerfile like above it does work quite OK installing / running it without MySQL, so that's great! I'm more concerned whether or not SQLite can indeed run without errors with popular plugins like Yoast: #39
The SQLite project got neglected for a couple of months because of the upcoming WP 6.3 release, we needed to focus on that. I'll try to get back on the horse and see what we can do for these things 👍
Reacted by Maarten den Braber, Zachary K. Watkins and kznaing
The SQLite project got neglected for a couple of months because of the upcoming WP 6.3 release, we needed to focus on that. I'll try to get back on the horse and see what we can do for these things 👍
We want people to use WordPress on the Raspberry Pi, so wanted an easy process to use this plugin without needing the MySQL server.
Thank you @mdbraber for the docker file. I used it as a guide to create a more generic installation process. I think SQLite as an alternative holds much potential!
Played a bit more with the plugin. I understand the SQLite requirements that is causing people to do 777 on the database folder and file. However I have changed the blog post to mimic what the plugin does,
I've resumed working on a solution which can initialize this plugin and run <?php wp_install(); ?> to provide a default site without asking a user to go through the site setup UI. The NPM package @wordpress/env provides a Dockerized WP installation with a preset site and I want that DX without Docker.
Would you accept a pull request if I found a way to make the plugin easier to provide this functionality natively?
If it turns out that the replacement wp_install() function this plugin provides does throw an error in the default PHP web server without a MySQL server being available, then I could add a conditional statement that checks for MySQL availability without throwing a database exception that halts the request.
Use Case
If someone has no experience with WordPress, I want them to have a plugin template repository they can install and run in a few CLI commands:
It's difficult to determine when to run the wp_install() function from another plugin while avoiding running core WordPress functions that attempt to access the MySQL database, thus resulting in a database access error.
Non-PHP Solution
Running sqlite3 from the command line to seed the database: sqlite3 wordpress/wp-content/database/.ht.sqlite < demosite.sql.
I'm surprised that no none has brought up WP-CLI for this. Wouldn't it be cool if you could just do something like wp core download && wp core install --with-sqlite?
Reacted by crabique, isla w, Luiz Bills, nickchomey, Brian Alexander, Ben Harris, Aslak Raanes, mbingel, Brandon Kraft, Sören Wünsch and 1 more
Activity
csears commentedon Feb 8, 2023
I ran into the same problem.
I've been looking at the code in the plugin's activation function. I'm wondering if there's some way to perform the same steps manually to get the sqlite support configured before initializing WP for the first time.
jeff-cannapress commentedon Feb 27, 2023
So from my experience making docker images using the wp-sqlite-db dropin, the process would look something like this:
WP_CONTENT_DIR.'plugins/sqlite-database-integration/db.copy'toWP_CONTENT_DIR.'/db.php'{SQLITE_IMPLEMENTATION_FOLDER_PATH}and{SQLITE_PLUGIN}per the contents ofactivate.phpwp_config.phpas thesetup-config.phpscript will explodefor the wp-sqlite-db based docker image I use, I include a custom version of
setup-config.phppatmood commentedon Mar 17, 2023
@jeff-cannapress do you have an example of a dockerfile that does this?
csears commentedon Mar 19, 2023
@patmood Here's the contents of the Dockerfile I used to get it working...
Note that I had to manually make the changes @jeff-cannapress mentioned to
db.phpbefore copying it into the image. The environment variables are needed so the setup doesn't prompt you for MySQL connection info, but otherwise are not used.If the authors of the patch feel like things are stable enough and folks are interested in testing it out via Docker, I'd be happy to publish the image.
jeff-cannapress commentedon Mar 20, 2023
@patmood I dont have one using the currently under-development plugin. However here is the version I use for local development based on the wp-sqlite-db plugin:
https://github.com/jeff-cannapress/wp_sqlite_docker
This integrates adminer for database access via a shared volume in docker-compose. If all you're looking for is to spin up a site without a mysql instance: https://github.com/jeff-cannapress/wp_sqlite_docker/blob/main/.docker/wordpress/Dockerfile is the docker file
mdbraber commentedon May 25, 2023
For those interested, this is a Docker file I've used to build a Docker container containing Wordpress, Nginx and SQL database integration. Mostly based on https://github.com/TrafeX/docker-wordpress/blob/master/Dockerfile and this thread / links (Wordpress 6.1.1, plugin in 1.2.2). See https://github.com/TrafeX/docker-wordpress for the other referenced files.
mdbraber commentedon May 26, 2023
For those interested: here's a Github repository for getting Wordpress with SQLite setup in Docker without any need for MySQL https://github.com/mdbraber/docker-wordpress-sqlite
aristath commentedon Jul 19, 2023
As long as SQLite is in the form of a plugin, there is no straight-forward way to setup a new site without using MySQL - unless you manually go through the steps in the original post.
I do keep a branch of WP with SQLite integration if you would like to test that though... You can find it in WordPress/wordpress-develop#3220 and it basically integrates the classes and functions from this plugin, as well as add some changes to the install screen to make it easy to actually install a new WP site using SQLite 👍
mdbraber commentedon Jul 19, 2023
@aristath TBH with the Dockerfile like above it does work quite OK installing / running it without MySQL, so that's great! I'm more concerned whether or not SQLite can indeed run without errors with popular plugins like Yoast: #39
aristath commentedon Jul 19, 2023
The SQLite project got neglected for a couple of months because of the upcoming WP 6.3 release, we needed to focus on that. I'll try to get back on the horse and see what we can do for these things 👍
ZachWatkins commentedon Jul 22, 2023
I just discovered this plugin and am excited to hear it's being worked on! I'm using this plugin on Windows with wp-phpunit for removing dependence on Docker for my test environment. Link: https://github.com/ZachWatkins/wordpress-theme/blob/main/test/phpunit/bootstrap.php
Implementation
composer.json:wp-phpunit/wp-phpunit,yoast/phpunit-polyfills,roots/wordpress, andwordpress/sqlite-database-integrationas dev dependencies using Composer.bootstrap.phpfile before it loads WordPress. This lets me enable or disable SQLite mode using an environment variable:locol-media-dev commentedon Sep 14, 2023
We want people to use WordPress on the Raspberry Pi, so wanted an easy process to use this plugin without needing the MySQL server.
Thank you @mdbraber for the docker file. I used it as a guide to create a more generic installation process. I think SQLite as an alternative holds much potential!
mati75 commentedon Sep 14, 2023
@locol-media-dev
chmod 777 for database file is a tragic security failure
locol-media-dev commentedon Sep 14, 2023
Fair, I will spend the weekend sorting out the right permissions and revise.
locol-media-dev commentedon Sep 17, 2023
Played a bit more with the plugin. I understand the SQLite requirements that is causing people to do 777 on the database folder and file. However I have changed the blog post to mimic what the plugin does,
Happy to improve further but probably need guidance from the team.
ZachWatkins commentedon Oct 1, 2023
I've resumed working on a solution which can initialize this plugin and run
<?php wp_install(); ?>to provide a default site without asking a user to go through the site setup UI. The NPM package@wordpress/envprovides a Dockerized WP installation with a preset site and I want that DX without Docker.Would you accept a pull request if I found a way to make the plugin easier to provide this functionality natively?
If it turns out that the replacement
wp_install()function this plugin provides does throw an error in the default PHP web server without a MySQL server being available, then I could add a conditional statement that checks for MySQL availability without throwing a database exception that halts the request.Use Case
If someone has no experience with WordPress, I want them to have a plugin template repository they can install and run in a few CLI commands:
Issue
It's difficult to determine when to run the wp_install() function from another plugin while avoiding running core WordPress functions that attempt to access the MySQL database, thus resulting in a database access error.
Non-PHP Solution
Running
sqlite3from the command line to seed the database:sqlite3 wordpress/wp-content/database/.ht.sqlite < demosite.sql.luizbills commentedon Oct 8, 2023
I ran in this issue too and decided to create this little script: https://github.com/luizbills/create-wordpress-sqlite
My goal was to be able to quickly install a WordPress on Termux (just out of curiosity).
swissspidy commentedon Oct 25, 2023
I'm surprised that no none has brought up WP-CLI for this. Wouldn't it be cool if you could just do something like
wp core download && wp core install --with-sqlite?Fix re-entrant deadlock in Turso's sqlite3_finalize