How to detect where the server is running in PHP
An easy way to define where your application is running is to look at the server global array variable , in here you can find all kind of information about the HTTP request
$isLocal = $_SERVER['HTTP_HOST'] == 'localhost';
then you can toggle different behavior like:
if($isLocal) {
debugApp();
}
Written by Roberto Arosemena
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#