Script to assist with installing Wordpress completely from the command line.
PHP Shell


Wordpress CLI Installer


A script to install Wordpress completely from the CLI, which makes automation that much easier.

The idea is to have a PHP script that just does what the regular Wordpress installer does, but done through the CLI. However, since using PHP's CLI binary is somewhat awkward, you can instead use the bash shell script which is generated (using and contains the complete PHP script. Thus you can do something like this:

$ curl -s | tar xzf -
$ wget -q && chmod +x
# edit wordpress/wp-config.php to change db settings, or add them to the next command
$ ./ -T 'My New Blog' -e '' -b '' wordpress/

Or you can just use bits of the PHP in your own installing script!


You can use the shell script like so:

Usage: [-hPv] -b base-url -e email-address [-p admin-password]
    [-T blog-title] [-u admin-user] [--dbuser=database-user] [--dbpass=database-pass]
    [--dbname=database-name] [--dbhost=database-host] path/to/wp/files/

Or you can use the PHP script directly with the same options like this:

$ php -f wordpress-cli-installer.php -- [options] path/to/wp/files/

General Options

-b base-url

Base URL for the blog since wordpress can't detect it from a CLI install, should be a fully qualified URL (ex:


-e email-address

Admin user's email address


-h Display this help text
-p admin-password

Admin users's password

default: randomly generated


Toggle whether the blog is public or not (visible to search engines, etc)

default: public (on)

-T blog-title

Set the blog's title, this should probably be short (and quoted)

default: Change Me

-u admin-user

Admin user's username

default: admin

-l lang

Language of this wordpress blog

default: <empty> (en-US)

-v Verbose flag, enable more output

wp-config Options

These options are only used if wp-config.php isn't found, in which case they are required (except for dbhost which has a default):

 Database user's username
 Database user's password
 Database name

Database hostname. Passing host:port or /path/to/socket.sock might also work

default: localhost