I found a way to create a pretty close pre-production environment that is secure and safe. One of the biggest problems with setting up an environment is all the variables and options. Below is the culmination of 2 years of searching and tweaking and trying various solutions. This one actually works (for me) very well, stable, simple and quick (once it is set up).
Although not a true pre-production (as it actually resides on another server), but I have found this process to be simple and have not had any problems with it yet... I have listed the specs at the end of this post. All URL's to the free software I have referred to in this post can be found in
myBlog.My host (a LAMP- Linux, Apache, MySQL, PHP) provides "Home Directory" and "Database" back-up buttons. When clicked, the database is backed up as a .gz (150kb) file and the Home Directory is compressed into a .tar.gz (4.5Mb) file. Now at this stage I have a full backup of all files and database in the site. This takes about 4 minutes and there are other ways of doing database backups and ftp'ing files for back-ups...
Then using the xampp (I used the windows version with the installer) which can be downloaded for free from apache friends:
As you are installing it, install apache and MySQL as services.
Turn on FURL's on your localhost:
Navigate to the xampp/apache/conf/httpd.conf, open it with a text editor and uncomment the:
LoadModule rewrite_module modules/mod_rewrite.so
to turn on Friendly URL's (FURLS) -if your downloaded site uses them.
Downloading and installing this software takes about 15 minutes- but you've now got your own local server.
Next, extract the backed up files using something like Universal Extractor (downloadable for free). Extract them to a sub-directory. Navigate inside the extracted files to the public_html folder, go inside that and copy all the files and folders inside.
Navigate to your xampp/htdocs/ folder. Create a new folder in the name of your site eg: pp.mysite.com.
C:\xxamp\htdocs\pp.mysite.com\
Paste all the files and folders into this new folder (or ftp a back-up of your site to this folder). Now all your files are on the local server, all you need to do is create your database.
In xampp (type "
http://localhost" into your browser to access it). Navigate to PHPMyAdmin (the default username is root and the default password is 'NULL' (that is nothing, or blank). PhpMyAdmin>Home>Create a new database (with the same name of the one you have on the live server). (If you are not sure, have a look at the file: manager/includes/config.inc.php (open it with wordpad or an IDE) and look at the database details:
// Etomite database connection parameters
$config_release = "1.1";
$database_type = "mysql";
$database_server = "localhost";
$database_user = "username";
$database_password = "secretPassword";
$dbase = "`account_database`";
$table_prefix = "etomite_";
PhpMyAdmin>Home>Privileges> Add a new user with the same name and password as your live site and assign the user to the database you created (don't give more rights than your live site has, otherwise you run the risk of creating code that is not useable on your live site).
PhpMyAdmin><yourdatabase> >Import> Navigate to your .gz (or other export from your database) backup file and import it.
Open your site in your browser (
http://localhost/pp.mysite.com/manager )
Log into your etomite manager, clear the site cache, save the site configuration settings and you now have a mirror of your site that you can continue development.
If you stuff it up beyond repair, simple drop all the tables in the database and re-import the .gz file, and re-copy and paste all the files from the .tar.gz extracted folder, and you have a clean mirror of your site again.
Once you are happy with the changes to your site, you can ftp up the contents of the xampp/pp.mysite.com folder and do an export and import of your database to make the changes (or just implement the additions manually once tested if you are more cautions or if there are only a few changes).
This process has worked so well (and this is probably not the recommended method of tackling an upgrade) that I had a pre-production 0.6.1.4 and a live production V1.1 and when I followed this process, my local pre-production 0.6.1.4 was upgraded to V1.1, without a hiccup!
A word of caution: Both sites should be as similar as possible, and all site links should be dynamically created. I also do not use wysiwyg editors or anything else that requires an absolute path. If this is you, you may have to spend some time tweaking these things to work inside the etomite manager. Also, hardcoded urls will obviously not work as the site links should have "
http://localhost" pre-pended to it, but seeing I always use dynamically generated URL using $etomite->makeURL(), this is not a problem.
Hope someone finds this useful.
The specs:
Live host:Apache version 2.2.6 (Unix)
PHP version 5.2.5
MySQL version 4.1.22-standard
Localhost:Toshiba Laptop running
Windows XP SP3
1.4GHz, 752 MB RAM (not a blazer as you can see)
Compatible in all browsers
xampp Version: XAMPP for Windows Version 1.6.6a