diff --git a/app/Helpers/network_helper.php b/app/Helpers/network_helper.php index 0fae83dba..d92f78cd9 100644 --- a/app/Helpers/network_helper.php +++ b/app/Helpers/network_helper.php @@ -46,6 +46,17 @@ function server_ip() { $ip_address_array = array(); + # MacOS + if (php_uname('s') == 'Darwin') { + $command = "ifconfig | grep inet | grep -v inet6 | grep -v '127.0.0.1' | awk '{print $2}' | cut -f1 -d'/'"; + exec($command, $output, $return_var); + if ($return_var == 0) { + foreach ($output as $line) { + $ip_address_array[] = trim((string)$line); + } + } + } + # linux if (php_uname('s') == 'Linux') { $command = "ip addr | grep inet | grep -v inet6 | grep -v '127.0.0.1' | awk '{print $2}' | cut -f1 -d'/'";