Best Way To Use Same Files for Live and Local
Posted on 2013-05-13
I want to use the same files whether they are on my live server or on my test server.
I have a config file /includes/config.php that I load into each file
<?php require $_SERVER['DOCUMENT_ROOT'].'../includes/config.php';?>
When this file is loaded, it contains the paths for either local or live, Its just the trick of getting it to load.
On my test server the doc_root is C:\xampp\htdocs (but then in a difft folder /testsite)
On my live server the doc root is /home/live/live.net
What is the simplest way for me to achieve this with code I DON'T have to change if I were to load this site on any server?