How to install wordpress using php script?

Mmd Mahbub asked:

I am trying to create a system that will install WordPress without any browser interaction like-

  • I will create a database
  • I will upload/create WordPress required database tables manually
    (I have installed a WordPress normally then collect the database tables and imported them into database).
  • I will create a wp-config.php manually and fill it with necessary
    information what it requires(database name,username,password,Authentication Unique Keys etc).

Now problem is after done this process I ended up on here –
It redirects me on

How to achieve install WordPress without any interaction from user,completely automatically?

Note: I am actually trying to install WordPress on behalf of my users
when they would register on my platform it will install a WordPress
on their wildcard subdomain automatically which I don’t want to let them touch
any part of WordPress installation

My answer:

You can use the wp command to perform an installation of WordPress.

Use the command wp core download to download the latest version of WordPress, and wp core install or wp core multisite-install to install WordPress using the name, email and database credentials you supply.

See the documentation for wp core for more details.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.