Setting up a WordPress development environment on your hosted server

If you are running WordPress but you don’t do your development and testing on a separate development copy then this article is for you. This, the second in a series of articles on WordPress security, will discuss how to set up a copy of WordPress on your hosted server for development and testing. In the last article I discussed Setting up a local WordPress development environment using WAMP or MAMP on your PC or laptop. But what if you want to run your development environment on your server? I will run through the steps to do this below.

Creating a development environment on a subdomain

Whilst there are undoubtedly many ways to set up a development environment, my preferred method is to do it on a subdomain of your live production website. If you set it up correctly nobody need know it’s there and for me it keeps things tidy, especially if you have multiple domains on your hosted server.

This article assumes that you have a hosting account with a service provider such as BlueHost, Godaddy, HostGator, HostMonster, Rackspace, etc. It also assumes that the hosting provider has cPanel and phpMyAdmin and that you are familiar with these tools. Basic knowledge is required in order to follow this How To.

Setting up a sub-domain in cPanel

  1. Log in to your hosting account with your username and password
  2. Scroll down until you find the Domains box
  3. Click on Subdomains
  4. Enter the Subdomain name. The Document Root field will be populated for you.
  5. Click the Create button to set up your subdomain

Now that your subdomain has been created you wil need to create the database for use by WordPress. To do this, follow the steps below:

  1. In cPanel, find the Databases box and click on MySQL Databases
  2. Enter a name for your database in the Create New Database box. Make sure that the database name is descriptive and unique. Do not use spaces and try not to use special characters. Keep it simple, for example: mydomaindevDB
  3. Click the Create Database button
  4. Make a note of your database name, you will need that later
  5. Click Go back to return to the MySQL Databases screen

Now you need to create a database user and give them permissions for your new database. If you already have a user created then you can add it to the database. Otherwise you will need to create a new user. First, we will walk through creating a new user:

  1. Scroll down the MySQL Databases screen until you see MySQL Users
  2. In the fields below Add New User, enter a username. The username should be unique
  3. Enter a strong password or click the Password Generator button if one is provided
  4. Click the Create User button
  5. Make a note of the username and password as you will need these later
  6. Click Go back to return to the MySQL Databases screen

Now that you have created a new user you need to add them to the database. If you already had a user created then these are the steps to adding that user to your database:

  1. Scroll down the MySQL Databases screen until you see Add user to Database
  2. Select the user in the first drop down and select you database in the second drop down
  3. Click the Add button
  4. You should be redirected to the Manage User Privileges screen
  5. Check the All Privileges box or select every check box
  6. Click the Make Changes button
  7. Click Go back to return to the MySQL Databases screen

Now that the database is set up the next step is to download WordPress and install it. To do this, follow the instructions below:

Installing WordPress in your subdomain

  1. Download WordPress from and FTP it to your hosted server using any FTP client software
  2. Unzip the contents of the WordPress download into the folder that has been created by cPanel for your new subdomain. For example, if you created a subdomain called dev then there should be a folder called /public_html/dev
  3. Delete the empty WordPress folder and ZIP file if they exist
  4. Rename the file wp-config-sample.php to wp-config.php
  5. Edit this file using a simple text editor
  6. Scroll down until you find the following text – define(‘DB_NAME’, ‘putyourdbnamehere’);
  7. Replace the text “putyourdbnamehere” with the database name you chose when creating your database above
  8. Scroll down until you find the following text – define(‘DB_USER’, ‘usernamehere’);
  9. Replace the text “usernamehere” with the username you chose when creating your database user above
  10. Scroll down until you find the following text – define(‘DB_PASSWORD’, ‘yourpasswordhere’);
  11. Replace the text “yourpasswordhere” with the password you chose when creating your database user above
  12. Scroll down until you find the following text –
    • define(‘AUTH_KEY’, ‘put your unique phrase here’);
    • define(‘SECURE_AUTH_KEY’, ‘put your unique phrase here’);
    • define(‘LOGGED_IN_KEY’, ‘put your unique phrase here’);
    • define(‘NONCE_KEY’, ‘put your unique phrase here’);
  13. Replace the text “put your unique phrase here” in each line with a random set of characters. These keys can be any variation of random characters. I tend to bang on the keyboard to generate these keys. These should be complex to provide optimal security
  14. Scroll down until you find the following text – $table_prefix  = ‘wp_’;
  15. Replace the text “wp” with a unique name for your database. Keep it simple, do not use special characters
  16. Save this file and exit your text editor
  17. In a browser, enter the URL for your subdomain. For example,
  18. You should be redirected to /wp-admin/install.php and see a Welcome screen
  19. Enter a Blog Title and Your E-mail
  20. Uncheck the box that says Allow my blog to appear in search engines like Google and Technorati
  21. Click the Install WordPress button
  22. Copy the admin password or make a note of it and click the Log In button
  23. Log in using the admin password you copied in Step 22 above

Congratulations! You now have WordPress installed on a subdomain on your hosted server. Now you need to copy your live production blog or website across so that you have a development copy of it.

Steve has over 25 years of project management and service delivery experience. He started his career in defense communications before moving to the British Ministry of Defence where he worked for the British Army. For the past 15 years, Steve has worked in IT, managing large projects and enterprise clients. Recently he has worked with entrepreneurs and small businesses helping them to meet the needs of their growing client base. A recent immigrant from England, he brings some international flavor to the team.