Skip to content

Instantly share code, notes, and snippets.

@erm3nda
Last active March 27, 2023 11:41
Show Gist options
  • Save erm3nda/8444f8536b309ae198cb to your computer and use it in GitHub Desktop.
Save erm3nda/8444f8536b309ae198cb to your computer and use it in GitHub Desktop.
Creates and serves a fresh wordpress sqlite powered install from scratch
#!/bin/bash
# wp-cli basic install script with sqlite database.
# requires installing wp-cli.phar following instructions from http://wp-cli.org/.
# Download wp-package, by default does download en_US package (--locale="en_US")
wp core download --locale="es_ES"
# U can later install another language package
# wp core language es_ES --activate
# This part of the config is a bit dummy, cuz will be overrided by sqlite plugin
wp core config --skip-check --dbname=wp --dbuser=wp --dbpass=pass
# Go to plugins directorythen unpack and override db.php controller
cd wp-content/plugins
# Download sqlite integration plugin
curl -O https://downloads.wordpress.org/plugin/sqlite-integration.1.5.zip
# Unzip and delete package.
unzip sqlite-integration.1.5.zip && rm sqlite-integration.1.5.zip
# Move controller db.php one level up
mv sqlite-integration/db.php ../
# Return to main directory.
cd ../
# Install downloaded wordpress, set real data and set desired url:port
wp core install --title=Dev --admin_name=admin --admin_email="admin@example.com" --admin_password=pass --url="http://localhost:8080/"
# Run the server. Would run using PHP -S builtin server
# Remember to edit the right php.ini located at same dir than php.exe and not the one with apache's files
firefox http://localhost:8080 & wp server
@DanielRuf
Copy link

I made a fork with a new SQLite dropin file at https://github.com/DanielRuf/run-local-wordpress

@erm3nda
Copy link
Author

erm3nda commented Nov 8, 2021

Code is not mine at all, but don't know where did I get it.
Thanks for the advise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment