PHP Classes
elePHPant
Icontem

Change Web Site Mode: Switch access to sites between test and production

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2015-01-12 (7 months ago) RSS 2.0 feedStarStarStarStar 69%Total: 1,899 This week: 2All time: 1,961 This week: 593Up
Version License PHP version Categories  
changewebsitemode 1.0GNU General Publi...4.0Utilities and Tools, Testing
Description Author  

This class can be used to switch the access to sites between test and production versions.

Each Web site must have copy of all files in the production server and in a test server. This class allows the user to switch between the two copies of the site without having to change the URL.

It provides a GUI interface for switching between the test mode and production site.

The test version may be run in the local machine or in another machine.

Innovation Award  
PHP Programming Innovation award nominee
July 2007
Number 6
Sensible Web developers usually develop and test their sites using a development server that is distinct from the production server.

Testing a site often means switching tests between the development and production servers.

This package provides a neat trick that allows developers to test their sites in the development and production servers using the same URL.

Manuel Lemos
Picture of Nadir Latif
Name: Nadir Latif is available for providing paid consulting. Contact Nadir Latif .
Classes: 14 packages by
Country: Pakistan Pakistan
Age: 32
All time rank: 841 in Pakistan Pakistan
Week rank: 53 Up2 in Pakistan Pakistan Down
Innovation award
Innovation award
Nominee: 9x

Winner: 1x

Details provided by the author  
Made by: Nadir Latif (nadir1915@yahoo.com)

1) Overview:

-Allows web masters to work with multiple websites (any number) in test mode. Each web site must have copy on the live server and on a test server. The script allows user to switch between the two copies of the website without having to change the url.
-Provides a GUI interface for switching websites from test mode to live mode. The copy of the websites to be tested may be on localhost or on another machine. The script basically edits two files. The host file on localhost (from where the website is viewed) and the htaccess file on an apache server that hosts the copies of multiple websites to be tested.

2) Requirements

-Requires php 4.
-Apache web server on the computer which contains the copies of the websites.
-All web sites must be copied to the root folder of the apache web server.
-Each web site must be in a folder called public_html, which in turn must be in a folder of the same name as the web site. e.g mysite.com/public_html/index.php.
-Place a .htaccess file in apache's root folder.
-The web page produced by the script uses vbscript so the script must be viewed using internet explorer with activeX support for untrusted scripts enabled.

3) How it works:

-To bring a site to test mode, the script adds a line in host file using vbscript which causes the site webpage to be fetched from the test server instead of the actual webserver. An entry is also made in the local apache htaccess file which causes the page to be fetched from the web sites folder. If the website is in test mode the url will fetch the page from the test server, while if it is in live mode the page will be fetched from the actual server. All this will be invisible to the user.
-Only one website can be in test mode at a time.

4) Usage:

-Replace the string "E:\www\\" with the location of the web root of the test server.
-Replace the string "E:\www\.htaccess" with the location of a htaccess file on the web server that will host the multiple test websites.
-Replace the string "C:\WINDOWS\system32\drivers\etc\hosts" with the location of the host file on locahost.
-Place this script on the directory of a web server and access it using internet explorer with activeX support for untrusted scripts enabled.
-Feel free to contact me for any assistance regarding this script.
  Files folder image Files  
File Role Description
Accessible without login Plain text file change_mode.php Example sample file
Plain text file cm_functions.php Class Contains all functions
Accessible without login Plain text file readme.txt Doc. Help file
Accessible without login Plain text file LICENSE.txt Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
 100%Total:1,899All time:1,961
 This week:2This week:593Up
 User Ratings  
 
 All time
Utility:91%StarStarStarStarStar
Consistency:83%StarStarStarStarStar
Documentation:75%StarStarStarStar
Examples:83%StarStarStarStarStar
Tests:-
Videos:-
Overall:69%StarStarStarStar
Rank:229