PHP server name from the command line

Snippet

Can't use $_SERVER['SERVER_NAME'] in command line scripts for the host name. Use php_uname()

echo php_uname("n");

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.