Title: Installing WordPress from a CLI script
Last modified: August 20, 2016

---

# Installing WordPress from a CLI script

 *  [monk64](https://wordpress.org/support/users/monk64/)
 * (@monk64)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/installing-wordpress-from-a-cli-script/)
 * I’m trying to write some code to install wordpress from a CLI script. I have 
   a number of sites to setup and going to through installer for each one is tedious.
 * After generating the appropriate wp-config.php, my script looks like this…but
   it doesn’t seem to work. Ideas?
 *     ```
       #!/usr/bin/php -q
       <?php
       include ('/web/www.example.com/html/wp-load.php');
       include ('/web/www.example.com/html/wp-admin/install.php');
       $result = wp_install('/web/www.example.com/html/', 'dbname', 'someone@example.com', 1, '', 'password');
       extract( $result, EXTR_SKIP );
       print "result was $result\n";
       ?>
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [mbrsolution](https://wordpress.org/support/users/mbrsolution/)
 * (@mbrsolution)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/installing-wordpress-from-a-cli-script/#post-2387787)
 * Hi, this is very interesting what you are trying to do. I am not too knowledgeable
   in scripting. I am just curious to know how you are going to setup many sites
   with one script, to install each individual site and assign a user name, a database
   and a domain name per site plus assign a folder name or root installation; sounds
   challenging to me. I am keen to see the end result. Sorry if I am not any help
   but I am curious as to how you are going to achieve this.
 * Kind regards
 *  [mbrsolution](https://wordpress.org/support/users/mbrsolution/)
 * (@mbrsolution)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/installing-wordpress-from-a-cli-script/#post-2387788)
 * Have a look at this link [http://codex.wordpress.org/Installing_Multiple_Blogs](http://codex.wordpress.org/Installing_Multiple_Blogs)
 * I think this link will help you with your question.
 * Kind regards
 *  [TCBarrett](https://wordpress.org/support/users/tcbarrett/)
 * (@tcbarrett)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/installing-wordpress-from-a-cli-script/#post-2387844)
 * In what way doesn’t it work? Any errors? Does it do something?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Installing WordPress from a CLI script’ is closed to new replies.

 * In: [Installing WordPress](https://wordpress.org/support/forum/installation/)
 * 3 replies
 * 3 participants
 * Last reply from: [TCBarrett](https://wordpress.org/support/users/tcbarrett/)
 * Last activity: [14 years, 6 months ago](https://wordpress.org/support/topic/installing-wordpress-from-a-cli-script/#post-2387844)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
