Store
Community Documentation

v3 Knowledgebase

Setting up a development site from a live site

Hello,

Today we will talk about making a development site out of your live site. This is useful if your site is live and running but you want to have a safe zone where to test anything before it is shown to your members. This of course assumes that you have a site up and running.

Lets assume a few things first:
a) Your site is live in internet
b) We will call your site: http://site.com
c) You do not have a folder called "development" as in http://site.com/development



1. First thing is to make a new folder, two scripts cant run in the folder (not easily anyways) so the dev site will sit in the folder "development".

- To make a new folder you need to use an FTP client (at BE HQ we use filezilla but there are others) or CPanel's file manager, Im sure Plesk and other web admin interfaces allow this, if you are unsure how to do this ask your hosting company.

2. Now we need to copy all of your live files into the development folder, some FTP clients allow this automagically, but the common brute method is to download all of your site to a temporal folder and upload it to your development folder. This can take quite a while...
- Another way is via CPanel's file manager, and yet another way is to ask your hosting company (they are going to hate me after this Tongue)

3. By now, all of your files should be copied to /<public-folder>/development/ but if you go to http://site.com/development/ the site doesnt work. Thats because we need to tell the script it has been "moved", so we open the file /<public-folder>/development/include/setting/server.sett.php
Here we need to change
PHP:
$_CONF['core.folder'] = '/'


for:
PHP:
$_CONF['core.folder'] = '/development/'


Last we need to change the .htaccess file, so open the file /<public-folder>/development/.htaccess
Look for:
RewriteBase /
and change it for:
RewriteBase /development/

This should give you a working development folder in http://site.com/development/ But careful, it uses the same database as your main site. This means that if you change a setting in the development site it will also affect the main site. So to fix this we need to copy the database as well.

4. To copy the database first we need to have a target database, so create your database now, here is how if you have CPanel. Dont forget to create a user for that database or to assign an existing user to it.
Next you need to copy your database, here is a how to if you have phpmyadmin or access to mysql console, if you dont have either of those ask your hosting company for it.

5. Last, since you have a new database and a new user you need to update the server.sett.php again
Open the file /<public-folder>/development/include/setting/server.sett.php and look for:
PHP:
$_CONF['db']['host'] = 'localhost'
$_CONF['db']['user'] = 'your-old-user';
$_CONF['db']['pass'] = 'your-old-password';
$_CONF['db']['name'] = 'your-old-database'

replace accordingly, for example:
PHP:
$_CONF['db']['host'] = 'localhost'
$_CONF['db']['user'] = 'your-new-user';
$_CONF['db']['pass'] = 'your-new-password';
$_CONF['db']['name'] = 'your-new-database'


Last you should clear your dev site's cache, you can do this by going to /<public-folder>/development/file/cache/ and delete all the php files in that folder, this should leave only the index.html file there

Hope this helps



Glossary:
- public folder: is the folder that shows files when you visit your site via web browser, it most commonly is "/public_html", "/httpdocs" or "/www". You see this when you log in via FTP.