From CLI
PHP < 5.3.0
$localIP = getHostByName(php_uname('n'));
PHP >= 5.3.0
$localIP = getHostByName(getHostName());
More Related Contents:
- How to get the client IP address in PHP
- What is the most accurate way to retrieve a user’s correct IP address in PHP?
- Get the client IP address using PHP [duplicate]
- Get Country of IP Address with PHP [duplicate]
- Is it safe to trust $_SERVER[‘REMOTE_ADDR’]?
- IP Address of the machine in PHP gives ::1 but why?
- How to get the client IP address in PHP
- CloudFlare and logging visitor IP addresses via in PHP
- How can I get the client’s IP address in a PHP webservice? [duplicate]
- Check whether or not a CIDR subnet contains an IP address
- Which MySQL datatype to use for an IP address? [duplicate]
- We need a script to create a backup of all the files, database and email using third party Cpanel details in PHP
- How do I catch a PHP fatal (`E_ERROR`) error?
- Query with multiple values in a column
- Resumable downloads when using PHP to send the file?
- HTTP authentication logout via PHP
- Guzzlehttp – How get the body of a response from Guzzle 6?
- How do I install cURL on Windows?
- Adding minutes to date time in PHP
- PHP OOP core framework
- Autoloader for functions
- Remove .php extension with PHP
- PHP: Locale aware number format
- Reverse the letters in each word of a string
- Change sender name and email address for specific WooCommerce email notifications
- what is a good method to sanitize the whole $_POST array in php? [duplicate]
- Fatal error: Call to undefined method mysqli_result::fetch_all()
- strlen() php function giving the wrong length of unicode characters
- count() emitting an E_WARNING
- How do I convert an ISO8601 date to another format in PHP?