Have you ever wondered, if you could try some things on your local machine in WordPress without going through all the hassle of starting servers and SQL Lightweight databases and whatnot? I’m no talking about a docker-compose file of course, that would be the same thing with a little container and automation magic; But all the underlying processes would be the same. You don’t have to worry anymore, because we’ve got you covered.
SQLite as Database…?
SQLite is very Lightweight less complex database system. If we’re talking about an installation where you’re thinking of serving thousands of customers, then it’s not an ideal choice. But we’ll be considering a lite installation for in-house use only. So, SQLite works really good in this use-case.
WPSQLite is a really compact plug and play solution for the use case above. Everything is bootstrapped nicely in one project. All you have to do satisfy some per-requirements and execute
php wpsqlite install !
Just open the dist folder, download wpsqlite.phar and put it in your global path or use from local directory, whatever is convenient for you. For my linux mint system, I’ve put the file into ~/.local/bin foldar, renamed wpsqlite.phar as wpsqlite. For other systems, check out the repository for detailed instructions.
Make sure to stop any running apache/nginx/other process that is listening on your 80 port first!
pdo_sqlite, sqlite3 and curl extension must be enabled. If you’re using *nix based operating systems (Linux, Mac) then just open your php.ini and uncomment the line where it says
(Uncomment = remove the semicolon from the beginning of that line, so make it look like
;extension=sqlite3 and make it look like
extension=sqlite3 and enable curl. Look for the line
;extension=curl and enable it like this
Install Lightweight SQLite for Your PHP version
You may need to install sqlite library for your PHP version, for example if you have php8, you may need to install it like this on debian/debian-variants
sudo apt install php8.0-sqlite3
In my case, I was using version 7.2, so I ran the command
sudo apt install php7.2-sqlite3
Create a new site
Go to your directory of choice and run the commands below.
php wpsqlite.phar install
Just follow along your terminal prompt. This command will retrieve latest wordpress installation from wordpress.org using curl and configure to work with sqlite database.
Run a previously installed site
The *.wplocal.xyz domains have been configured to work with this installation . they are not publicly available, you can only visit your site from your local computer. To start a installed instance, go to your installation directory from terminal and run –
php wpsqlite.phar start <sitename> php wpsqlite.phar start abcd.wplocal.xyz
wpsqlite.phar start <sitename> wpsqlite.phar start abcd.wplocal.xyz
After the command, go to your browser and visit
In my specific case, I’ve executed
wpsqlite install. because I’ve renamed
Post Installation Requirement
If you want to install plugins and themes in your freshly installed WordPress you may encounter some errors. To resolve this just open your
wp-config.php and add the following line