I need to setup a path in my php but I currently don\'t know the path.
I need to configure the paths to the uploads directory
Should look like this below:
here is a test script to run on your server to see what is reliabel.
";
$server = $_SERVER['SERVER_ADDR'];
echo "_SERVER[SERVER_ADDR]: $server
";
$my_current_ip=exec("ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'");
echo "exec ifconfig ... : $my_current_ip
";
$external_ip = file_get_contents("http://ipecho.net/plain");
echo "get contents ipecho.net: $external_ip
";
?>
The only different option in there is using fiel_get_contents rather than curl for the extrernal website lookup.
This is the result of hitting the web page on a shared hosting, free account. (actual server name and IP changed)
gethostname and gethostbyname: freesites.servercluster.com at 345.27.413.51
_SERVER[SERVER_ADDR]: 127.0.0.7
exec ifconfig ... :
get contents ipecho.net: 345.27.413.51
Why needed this? Decided to point A record at server to see if it opens the web page. Later ran script to save ip and update on ghost site on same server to lookup IP and alert if changed.
In this case, good results optained by:
gethostname() &
gethostbyname($host)
or
file_get_contents("http://ipecho.net/plain")