Avoid bugs in configuration file

Programming for Search Engines 101. An area for avid PHP and .NET developers to chat about Programming techniques and how to make better use of search engines.

Moderator: Moderators

Avoid bugs in configuration file

Postby jay » Thu Jul 03, 2008 5:50 am

Programmers, here is the php code to be followed in config.php

Just needs to change the values of variable $running_server to "online" and "local", no more commenting or editing required.

Here is the php code.
<?php
$running_server="online"; //local - for running locally. online - for running online
if($running_server=="local")
{
//Local path settings starts here
define('DOC_ROOT','D:/Projects/newsite/'); // physical path local //
define('SITE_URL','http://www.newsite.com'/); // physical path local
//Local path settings ends here

//Local database settings starts here
define('DBHOST','projects'); // host name
define('DBUSER','root'); // mysql user name
define('DBPASS','14sdfs36'); // mysql pasword
define('DBNAME','testprojects'); // databse name
//Local database settings ends here
}
else //online settings
{
//Online path settings starts here
define('DOC_ROOT','/home/newsite/public_html/'); // site path
define('SITE_URL','http://www.newsite.com/'); // physical path local
//Online path settings ends here

//Online database settings starts here
define('DBHOST','localhost'); // host name
define('DBUSER','wyselabs_contact'); // mysql user name
define('DBPASS','9dfgmre3458@$#'); // mysql pasword
define('DBNAME','test_contactform'); // databse name
//Online database settings ends here

}
//Defining common path starts here

define('DIR_INCLUDE',DOC_ROOT.'db/');
define('DIR_FUNCTION',DIR_INCLUDE.'');
define('DIR_IMAGE',DOC_ROOT.'images/');
define('DIR_TPL',DOC_ROOT.'templates/');
define('DIR_RES',DOC_ROOT.'resources/');
define('MAIL_IMAGE_URL',SITE_URL.'mails/images/');
define('IMAGE_URL',SITE_URL.'images/');
define('RES_URL',SITE_URL.'resources/');
define('ADMIN_URL',SITE_URL.'admintest/');
define('ADMIN_IMAGE_URL',ADMIN_URL.'images/');
define('ADMIN_EMAIL','test@newsite.com');

//Defining common path ends here
?>

Hope this can help to avert the bugs appearing related to the configuration files and can be fixed easily if found.

Suggestions for improvement always welcome !
Jay M
Write Less, Do More
jay
 
Posts: 475
Joined: Wed Nov 22, 2006 12:05 am
Location: Cochin, India.

Return to Programming

Who is online

Users browsing this forum: No registered users and 12 guests