What I am trying to do is to automate wordpress website creation for the company I am working on. We have lots of information in our database for our customers and we want to create a wordpress website for each customer. The process works great and we have no trouble with the creation of websites/transfer of data or anything like that.

The problem we do have is when we buy a new domain (http://www.newdomain.com) our process breaks (we call a stored procedure which installs all the data after the URL is called to install wordpress) if the domain takes more than 15min to resolve. We have tried doing looping (where the process checks to see if the domain resolves and keeps trying - but eventually if fails). So what we are looking for is to see if there is a way to install an URL without actually having the domain resolve yet.

I have seen where possibilities where you can change the wp-config file but this doesn't work since we have more than one domain and it changes the source URL for all the domains. What we really need is just a way for us to manually start the install script through a call either through a database or some other way that doesn't check to see if the domain is resolved or pointing at the server or not.

Thank for any suggestions.

EDIT: All we do to install wordpress is call this URL: http://"newdomain".com/wp-admin/install.php?step=2 - if you change settings in the backend calling this URL will install wordpress without having to go through the wp-admin/install.php form

  • 3
    Dunno about the installer, but you can short-circuit the name resolution by inserting it temporarily into /etc/hosts (so it doesn't query the DNS).
    – Amadan
    Jun 3, 2010 at 17:30
  • I don't understand why you can't build a script to edit wp-config.php? It's likely to be the easiest way.
    – Pekka
    Jun 3, 2010 at 17:40
  • @Pekka - that is what I am looking to do but I haven't been able to find an easy, reproducible, automated process of doing this.
    – bvandrunen
    Jun 3, 2010 at 17:59
  • @bvandrunen do you mean the actual changing of the files, or what to change?
    – Pekka
    Jun 3, 2010 at 18:00
  • what to change/edit in the wp-config.php file.
    – bvandrunen
    Jun 3, 2010 at 18:03

5 Answers 5


As Amadan said: You can just temporarily hardwire the name resolution.

But what I would do in such a case is a file or db table that holds all domains to setup. Then just have a cronjob try a DNS call every 1-5 minutes. As soon as the domain is reachable start the setup and delete that domain from the file/table.

  • As I put in the comment for @Amadan - I will try his idea and this one - thanks for the comments...the biggest problem we are facing is keeping the solution simple, automated and low server usage. We don't want to tie up our server with 100's of DNS request
    – bvandrunen
    Jun 3, 2010 at 18:05
  • Thanks so much @Amadan and @b_i_d - we decided to go with the /etc/hosts way and it works perfectly. But since @Amadan only did a comment I am going to check up this answer since they both would work. Thanks for all your help
    – bvandrunen
    Jun 3, 2010 at 21:25
telnet 80
GET /wp-admin/install.php?step=2 HTTP/1.0
Host: www.domain.com

As long as you know the IP address that you need to get to, and the domain name you're trying to hit, you won't need to modify /etc/hosts

Curl, nc, wget can all send header requests as can a simple socket connection in your installation script.


A very simple way to achieve your desired goal is to set up once instance of Wordpress in the usual way, perhaps on an off-line test system. The installed version is nothing more than a directory tree of files and a database.

  • Using either existing knowledge or a search through the files locate the items that will need to be modified for it to work in another installation.
  • Dump the Wordpress database to file.
  • Create a script that can accept input, perhaps from a file, and modify the items that need to be changed for a new installation, using sed, Perl or whatever else you like.
  • Do the same for any items that need to me changed in the database dump file.
  • Script the creating of a Wordpress user and password for the database, create the empty database and set the permissions required.
  • Now just copy the Wordpress files to the target location, set the permissions, load the database dump file and test it.
  • Rinse and repeat...

You can use a combination of wp-capistrano and wp-generate to deploy WordPress and Cucumber-WordPress to test it. In fact some well-written cukes with Cucumber-WordPress should be enough to be able to build ad then test the wp-config file.

Editing the hosts file just to get WordPress seems wrong, not least because it means the deployment script (assuming it is scripted) then needs write access to the hosts file. Far better to get the generation of the wp-config file and the population of the database automated, all of which a combination of the above scripts will manage.


Just use WP-CLI. To install a new blog, type

wp core download
wp core install

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .