Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7718311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:08:12+00:00 2026-06-01T03:08:12+00:00

I am developing a PHP application that will be run only on the local

  • 0

I am developing a PHP application that will be run only on the local network of a business. The application will be installed to the server using a custom installer like thing we made using Stunnix Advanced Webserver.

As part of making the application more user friendly I am planning to display the LOCAL IP of the server so that it is extremely easy for the other computers in the network to access the application by just typing this IP in their address bar.

The problem is I cannot get the LOCAL IP of the server.

I have tried

SERVER_NAME ( Displays just 127.0.0.1 )

REMOTE_ADDR ( Displays client external IP )

SERVER_ADDR displays the correct IP but it does so only if I access it from a client using the IP which totally defeats its purpose.

I just want to display the LOCAL IP of the server upon access directly from the server through http://localhost itself.

I am somewhat sure that this isn’t possible. But if it is, please help.

EDIT

I am developing a cross platform PHP server application kind of thing. We bundle Apache,PHP installers and a SQlite database as a one click installer alongside our PHP application to make it as user friendly as possible. Anyone can deploy it on their computer running Windows,Mac or Linux. After installing when the user opens the application on the server he can see the ip address [local ip] and port which can be used to connect to this server. The application will be run only on the local network and not on the internet.

It should show the local IP just like the Android app called Air Droid does.
Screenshot : https://lh3.ggpht.com/PmLopRm-Lj9WTnzm2MBI-bTbCLopAyqtd4C_4nvyDwLg8X0QwDbBbEREdWGHG5xku4s

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T03:08:14+00:00Added an answer on June 1, 2026 at 3:08 am

    The problem that you have here is that this is not a static piece of information. Any given computer can have multiple IP addresses associated with multiple network cards. Some/all/none of those may have the web service available on them. There may not be a single answer to the question you are asking of the OS.

    If your server has a simple, single IP address configuration then you would probably be best to hard-code this – it is by far and away the simplest option. If you want to determine it dynamically, here are a few bits of information which you will hopefully find useful:

    • $_SERVER['HTTP_HOST'] contains the address that was typed into the address bar of the browser in order to access the page. If you access the page by typing (for example) http://192.168.0.1/index.php into the browser, $_SERVER['HTTP_HOST'] will be 192.168.0.1.
    • If you used a DNS name to access the page, gethostbyname($_SERVER['HTTP_HOST']); will turn that DNS name into an IP address.
    • $_SERVER['SERVER_NAME'] contains the name that has been configured in the web server configuration as it’s server name. If you going to use this, you might as well just hard code it in PHP.
    • $_SERVER['SERVER_ADDR'] will contain the operating system of the server’s primary IP address. This may or may not be the IP address that was used to access the page, and it may or may not be an IP address with the web server bound to it. It depends heavily on OS and server configuration. if the server has a single IP address, this is probably a safe bet, although there are situations where this may contain 127.0.0.1.

    The long of the short of it is that there is no 100% reliable way to determine a guaranteed working IP address of the web server, without examining information that was send to the web server in order to generate the page you are creating, which as you say totally defeats its purpose.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently developing a PHP application that's using an Access database as a backend.
I am developing a PHP application using our XAMPP setup as a test server.
I'm taxed with developing a custom e-commerce application for my company (using PHP/MySQL). The
Iam developing a php facebook application that will display the facebook score of the
I am developing small application in PHP that will need to store small number
I am developing an App that will interface with a web server (PHP with
We've been developing a web application (PHP, using the Yii PHP framework) that is
I a web application that I am developing (being developed in PHP) when a
I am developing a PHP/MySQL application using vertrigoserver. I need to enter the German
I am developing an web application using php. One of the requirement is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.