php - Determine whether current script is running on development or production server -
i've got scripts call different urls depending on if they're processed online site (release), or offline localhost (development). i'd find quick way find which.
i can come few clunky ways this, there definitive, fast, elegant method? if(is_offline()) { ... }
a variable called
$_server["computername"]
available on iis servers, can use determine if script running on development server or production server (mymachine vs. www37).you can use
$_server["http_host"]
variable (localhost vs. www.domain.com).you can create empty text file on development server (careful not upload it) , use
is_file()
check if presence (is_file(".foo") == true vs. false).you can check php_os if operating systems on 2 servers different (winnt vs. linux).
you can check presence of path inside
__file__
constant (c:/inetpub/wwwroot/website/ vs. /home/www37/).a variant of 3:
@include("override_server_with_local_config.php");
Comments
Post a Comment