xampp is showing default gateway instead of showing visit ip

Problems with the Windows version of XAMPP, questions, comments, and anything related.

xampp is showing default gateway instead of showing visit ip

Postby biobeo » 12. February 2015 11:55

I have a xampp server installed in a windows 8.1 cpu which I use as a public server for my clients. Now I have made a request box for my clients to drop some request on it, and I am saving their IP in db while sending data through php. I use this php script to get the clients IP address.

Code: Select all
function get_ip() {

//Just get the headers if we can or else use the SERVER global
if ( function_exists( 'apache_request_headers' ) ) {

    $headers = apache_request_headers();

} else {

    $headers = $_SERVER;


//Get the forwarded IP if it exists
if ( array_key_exists( 'X-Forwarded-For', $headers ) && filter_var( $headers['X-Forwarded-For'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ) ) {

    $the_ip = $headers['X-Forwarded-For'];

} elseif ( array_key_exists( 'HTTP_X_FORWARDED_FOR', $headers ) && filter_var( $headers['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 )
) {

    $the_ip = $headers['HTTP_X_FORWARDED_FOR'];

} else {

    $the_ip = filter_var( $_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 );


return $the_ip;


But XAMPP is showing the machine's default gateway instead of showing the visitor's IP.

How can I fix that?

** Note: The Server is alive and you can access it from anywhere using it's ip. and for some obvious reason I have to use xampp as an online server for my clients to better handle it on windows.
Posts: 3
Joined: 08. March 2012 06:35
Operating System: Windows

Re: xampp is showing default gateway instead of showing visi

Postby Altrea » 12. February 2015 20:43

https://community.apachefriends.org/f/viewtopic.php?f=16&t=67782#p232732 wrote:Scope of support

Evaluate if your topic is in scope of support of our board. We don't want to provide...
  • ...support for live, production or public accessible environments.
    XAMPP is not configurated for such environments (default passwords, many activated and probably unnecessary modules, not tweaked for performance, scalability, stability or security). This board does have several entrys about hacked XAMPP installations because of using unprotected XAMPP installations in not supported environments. XAMPP don't want to fit every possible use case and there are other (also free) alternatives for such environments.
  • ...enterprise or commercial oriented support.
    You and/or your company earns money for what you are doing. If you don't have the knowledge to solve XAMPP problems on your own, spend a part of your money to hire an expert or pay an it freelancer to solve such problems. We all need jobs and money to live and in a company or commercial oriented environments there are much more things to consider like legal requirements or network security. Every action can contain a financial risk so even answeres on simple questions have to be analysed if they fit all the rules the environment requires. This cannot be achieved in two sentences of a forum post.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
AF Moderator
Posts: 8243
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 37 guests