Am using $_SERVER['HTTP_HOST'] and $_SERVER['REQUEST_URI'] in a php script which forms a url.
$serverMode = isset ( $_SERVER ['HTTPS'] ) ? "https" : "http";
$serverpath = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
$serverHost = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] :'';
my formed path will be like,
$path = $serverMode.'://'.$serverHost.$serverpath."images/someinage.png";
When i run from a browser the path is formed correctly, but when i sun from terminal
php scriptname.php
These $_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI' ] are ignored. Is there a way to get the path correctly when running from terminal.