Getting config file of OS by PHP

I found the code block somewhere on the net. for some reasons I need it to be more complete and accurate, the comments of author that some OS are not tested… those OS vars return by PHP_OS are correct and their config file path and mac var e.g. HWaddr or ether are correct for those OS?
I seem the following OS are missing in function, what are:

  1. their OS var return by PHP_OS,
  2. path to their config file (e.g. /sbin/ifconfig etc.)
  3. MAC var (e.g. HWaddr or ether etc.)
    HP-UX
    IRIX64
    OpenBSD
    Solaris
    Unix
    RedHat
    Fedora

Please help to make the function as much complete as possible, I need it.

		function _get_os_var($var_name, $os)
		{
			$var_name = strtolower($var_name);
			# switch between the os's
			switch($os)
			{
				# not sure if the string is correct for FreeBSD
				# not tested
				case 'freebsd' : 
				# not sure if the string is correct for NetBSD
				# not tested
				case 'netbsd' : 
				# not sure if the string is correct for Solaris
				# not tested
				case 'solaris' : 
				# not sure if the string is correct for SunOS
				# not tested
				case 'sunos' : 
				# darwin is mac os x
				# tested only on the client os
				case 'darwin' : 
					# switch the var name
					switch($var_name)
					{
						case 'conf' :
							$var = '/sbin/ifconfig';
							break;
						case 'mac' :
							$var = 'ether';
							break;
						case 'ip' :
							$var = 'inet ';
							break;
					}
					break;
				# linux variation
				# tested on server
				case 'linux' : 
					# switch the var name
					switch($var_name)
					{
						case 'conf' :
							$var = '/sbin/ifconfig';
							break;
						case 'mac' :
							$var = 'HWaddr';
							break;
						case 'ip' :
							$var = 'inet addr:';
							break;
					}
					break;
			}
			return $var;
		}

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.