Install WordPress and wp-cli on Repl.it using SQLite
- Create a new Repl.it as a PHP Web Server
- Update the replit.nix file to include the code in this repo
- Restart the Repl
- Run this command from the Replit shell:
bash <(curl -s https://raw.githubusercontent.com/ethanpil/wordpress-on-replit/master/install-wordpress-on-replit.sh)
- WordPress is running on a local SQLite file. Not performant. Great for testing and hacking.
- WordPress is running on PHP's built in web server which doesn't support rewrites (fancy URLs)
- Subject to all of the limitations of the SQLite plugin
I would like to explore setting up a Router Script for the PHP web server to see if I can get rewrites working. Some initial research:
- https://old.romaricpascal.is/writing-about/running-worpdress-with-php-built-in-server/
- https://gist.github.com/thiagof/d940f8fe4b265c8c15f3109b45aa5001
- https://www.php.net/manual/en/features.commandline.webserver.php
- https://stackoverflow.com/questions/27381520/php-built-in-server-and-htaccess-mod-rewrites
Repl.it now allows users to configure a REPL via Nix. The newest Nix environments include packages for PHP with SQLite Support, as well as WP-Cli support. So everything you need is now available. (Unlike in the past when we really had to go deep in and mess with things in a nasty way).
All we have to do now is setup Repl to load in the correct Nix packages and install WordPress with the SQLite plugun. The replit.nix
file in this Repo includes the necessary Nix packages and the Bash script install-wordpress-on-replit.sh
simply automates the Wordpress install.
The script does the following:
- Check to make sure Nix has installed the packages needed for WP-Cli (less and wp).
- Download WordPress files through WP-Cli
- Download and install the SQLite plugin for WordPress
- Create a basic
wp-config.php
file with some tweaks for Replit and your Repl URL. - Ask for your prefered credentials and install WP
Nix Version:
Orignial Version: