Check if is local connection in PHP (by IP comparison)
<?php
function isLocal(){
return $_SERVER['SERVER_ADDR'] === $_SERVER['REMOTE_ADDR'];
}
Then you can use it like
$dir = isLocal() ? '/root/' : 'webhosting/data/';
Written by Ivan Castellanos
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#