Created
March 24, 2024 15:44
-
-
Save vandanojan/d095229548a177da4c7726a0095d2e19 to your computer and use it in GitHub Desktop.
This PHP script checks if the exec() function is enabled on the server. If so, it retrieves the server's IP address using the hostname -i command and returns it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (function_exists('exec')) { | |
$ip_from_exec = exec('hostname -i'); | |
echo "IP Address (via exec): $ip_from_exec"; | |
} else { | |
echo "exec() function is not enabled on this server."; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment