Skip to content

Instantly share code, notes, and snippets.

@bburky
Created March 3, 2014 03:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bburky/9317876 to your computer and use it in GitHub Desktop.
Save bburky/9317876 to your computer and use it in GitHub Desktop.
Instantly download and run WordPress using SQLite
#!/bin/sh
# One line:
# curl -L http://git.io/wp.sh | sh
# Optionally specify port number:
# curl -L http://git.io/wp.sh | PORT=8888 sh
# The directory "wordpress" will be created in the current directory.
test -e wordpress && echo "wordpress/ already exists" && exit
# Download latest WordPress and extract to wordpress/
curl https://wordpress.org/latest.tar.gz | tar -zx
# Install SQLite Integration to avoid a MySQL server
# https://wordpress.org/plugins/sqlite-integration/
cd wordpress/wp-content/plugins/
curl -O https://downloads.wordpress.org/plugin/sqlite-integration.1.5.zip
unzip sqlite-integration.1.5.zip
rm sqlite-integration.1.5.zip
mv sqlite-integration/db.php ../
# Open http://localhost:8080/
echo
echo "Configure wp-config.php with default DB settings, they're ignored"
echo
( ( sleep 2 &&
( type xdg-open && xdg-open "http://localhost:${PORT-8080}/" ) ||
( type open && open "http://localhost:${PORT-8080}/" ) ) & ) >/dev/null 2>&1
# Start the built-in PHP web server
# Requires PHP 5.4.0 or newer
cd ../../
php -S "localhost:${PORT-8080}"
# That's all!
@bburky
Copy link
Author

bburky commented Mar 10, 2014

Alternatively use wp-cli and wp-cli/server-command:

wp core download

wp core config --skip-check --dbname=wp --dbuser=wp --dbpass=pass

cd wp-content/plugins
curl -O https://downloads.wordpress.org/plugin/sqlite-integration.1.5.zip
unzip sqlite-integration.1.5.zip
rm sqlite-integration.1.5.zip
mv sqlite-integration/db.php ../
cd ../../

wp core install --title=Dev --admin_name=admin --admin_email="admin@example.com" --admin_password=pass --url="http://localhost:8080/"

wp server

@erm3nda
Copy link

erm3nda commented Aug 3, 2015

WOW, i like!!! i was thinking on make something like that as localhost web notepad :D so wordpress is the best for that. Thank you so much i will test both options.

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