The php Function php_Uname
The php function php_uname returns a description of the operating system that PHP is running on. It is the same string that is displayed at the top of phpinfo() output. Alternatively, you can use the PHP_OS constant to get the same information without PHP having to perform its own underlying uname() call.
In addition to php_uname, a number of other miscellaneous php functions are available. Some of these are useful for getting other types of information about your server and the operating system. These include phpinfo(), php_sapi_name(), and get_defined_constants(). Others are useful for various purposes such as removing whitespace and comments from a PHP file or putting the script to sleep for a certain number of seconds.
Is there a way to get the hostname of the machine that PHP is running on? I want to include this info in an email that goes out to customers when their orders are shipped.
Getting the host name of the machine is not difficult in PHP. However, it may not be what you are looking for if you need to know about the operating system that the machine is running on.
The php_uname function is a good option for this purpose, but I've also found the following other functions to be quite helpful:
php_strip_whitespace() - Removes all whitespace and comments from a PHP file.