I have an application created in php and using MySQL for back-end. I connect to the front-end of application on my PC by typing
(http://localhost:8080/my_data/login.php)
in the browser. the database is in my computer and php files are also in my computer. i don't know how can other users can get access to the application from the browser in their pc..i am not good with networking stuff.
(I am assuming Windows). At your machine at a command prompt type ipconfig to get your IP address:
specific instructions:
click windows orb,
then type cmd in text area
type ipconfig and press enter
line reading IPv4 Address will have an IP address x.x.x.x... use that IP address in place of localhost.
Assuming others on network are within the same subnet and not have vlans and what not, it should work.
a URL uses something called DNS or a hosts file to lookup that name and translate that common name to an IP address, by specifying the IP address and port, you avoid the need for the DNS, assuming the IP address is "Routable" for the users needed to access it.
Here's an example: Type http://74.125.225.176 in a browser and you get google search! There's a lot more to this really, but this is just the basic workings.
Related
In this version of wampserver the option "put online" is no longer available, I made a php application with a virtualhost and I would like to put it online or locally on the company's wifi box.
thanks
1 .To put your website in your LAN, u need to know your device's LAN ip address. open your command line and use this command to get your local ip address:
ifconfig
then find your php.ini file to get your apache service port, glue the ip address and port, others in your LAN can visit your website. like: 192.168.1.110:8080
2.to put your website online, there is a whole bunch of stuff u need to learn. please find a article or book, it's hard to explain that in a short reply
I have a MySQL wamp server running on my laptop. I created a php file to run a SQL query on the database and return some rows. When I run the php file on a browser in my laptop with the URL
http://192.168.2.10/getData.php?sender=x
I get the result. I can get the same result with the same URL on a browser of my mobile phone connected to the same network. But, I cant get the result when I use mobile data instead of the network used by the laptop.
I studied about it and found out I have to use
GRANT ALL PRIVILEGES ON chats.* TO 'user'#'%' IDENTIFIED BY 'password'
which I did. Then, on the mobile phone I figured I have to use some combination of global and local IP of the server. But what combination should I use?
When your using php, the connection made needs to be "seen" from the server which executes the .php script (that can be different ip then your mysql server). In that case you need to make sure the user used has either user#% where % means allow form any ip, or user#ip where ip is the ip connecting from.
On your mobile phone you enter the ip of the webserver + the path to the .php script. In your case that seems to be http://192.168.2.10/getData.php?sender=x
Now you need to make sure that the webserver is bound to your external ip adress (and not localhost) in that case you the url will not work. To be sure all works, take another pc/laptop (in the same network) and check if you run the script from the browser.
Logically if your phone is connected to mobile + LAN, you should able to access the link (http://192.168.2.10/getData.php?sender=x) without grant anything to mysql user, since the getData.php is using "localhost" to connect to mysql, correct me if i'm wrong.
If your requirement is : Laptop (LAN) and Phone (on mobile data), and you want to use your mobile to access the laptop url, then you will need external IP of your LAN connection and proper port 80 forwarding to your laptop IP from router/modem. After that, you should able to access to your laptop using the http://LAN'sExternalIP/getData.php?sender=x using your phone. If your LAN connection is without internet connection. Then it is not possible to access it from phone (mobile data).
Other than that, you will also need to do some setting to your wamp's apache configuration, which you can refer here. And also need to Put the wamp to online by right click its icon near taskbar.
I am using N-Computing(N-Computing is hardware which create virtual desktops which enable multiple users to simultaneously share a single operating system instance.) server to run the project on LAN.
I run the system at client PC using server ip insted of localhost
i.e.192.168.1.33/demo/demo.php .
My Problem is i want to fetch ip address of client PC using php code which run at server.
I tried some code which gives the ip address of server.
This is not possible because with N-Computing, it actually creates multiple OS users on the same physical computer. In reality its like multiple users logged in onto one laptop/computer with different accounts. And as you might suspect, it means these users share the same hardware, mac addresses and ip address on all the network interfaces that they have.
If you do ipconfig on any of you users you will notice the ip address will always be 192.168.1.33. This means PHP will give you the same IP address for all your logged in users..
That said, you could maybe give more information as to what exactly you want to achieve, so that we can suggest a workaround.
EDIT
To get different IPs please try NComputing IP Utility, this will give different ips for your clients, THEN you can use the php script.
echo $_SERVER['REMOTE_ADDR'];
to get the IP address of the user.....
I have downloaded WAMP server and i have written a very very simple php code and saved it in
C:\wamp\www\php_lear
folder. I have tested it using chrome giving url as
{localhost/php_lear/eg2.php}
And it worked fine. This uses a database stored in phpmyadmin. I found out my ip address from google 117.195.230.41. When i give
{117.195.230.41/php_lear/eg2.php}
as URL it gives me 404 not found
"The requested URL '/php_lear/eg2.php' was not found on this server"
Please help. I have no knowledge of ips and urls and very new to this field and yeah i have added this ip as allowed user in phpmyadmin. I actually want to use this in my android app.
The IP address you get from google is the IP address of your router. It does not point to your computer. As some ppl said, besides there is different ports to use in a connection and your WAMP installation is "listening" on the port 80 of your computer (127.0.0.1)
When you access to the 117.195.230.41 you are accessing to the IP that your Internet Service Provider gives to your installation. So you need to access your router and redirect all the querys to the 117.195.230.41 on port 80 to your port 80 and the IP of your computer in your local network.
The Public/Private IP confusion is a common misunderstanding.
Mike is correct. Due to how IP addressing works, there's a limited number of addresses. As a result, Network Address Translation was born (among other irrelevant things). The Public IP is what the world sees when it glances at your traffic. You want your Private IP, the one your router's DHCP has given you.
1) Open command prompt.
2) Issue the command "ipconfig" (without the quotes).
3) Find your "IPv4 Address". That's the one you want.
Additionally, follow Surt's suggestion to get everything working properly.
If I'm on a local network is there a URL that I can type that will allow all users on the local network to view a local hosted website?
There is one feature called put online but I would need to be connected to the internet. Can it be done another way?
I know this question is off subject but I get fast responses here. and its somehow related :)
You can use either your local IP or your hostname on the network.
For the hostname to work, your network needs a DNS server that updates itself from DHCP, or has a static entry for your computer, or all the systems need to have NetBEUI running. If you can type "ping " in a command prompt/console window, and it shows it pinging your network IP, then it works.
they have to enter your ip
You could use your local network IP address to address your machine. But you have to configure your webserver to deliver the right content without a specific host name.