Reputation: 289
I want to connect my Android phone to XAMPP server of my pc to run my app on phone's browser (app is working fine with pc's browser).
I am using broadband connection. The only solution which I've got until date is through using wifi connection.
But, I am restricted to use LAN connection. How can I connect it without using a router?
Upvotes: 28
Views: 112092
Reputation: 39
So, I was recently trying to do the same... I am using a framework like Opencart. Which allowed me yo use "localhost" as host name to run my initial setup. If you did the same. Go back to your config.php for your app and change the HTTP_SERVER from localhost to your ip address(found from techniques above). You must do it in your DB_HOSTNAME also. And you will need to either edit or create a new DB user that uses the ip address as the HOSTNAME. You create and modify DB Users in the phpMyAdmin of XAMPP.
Then instead of http://localhost/yourapp_path/ it will be: http://your.local.ip.address/yourapp_path/
Upvotes: 0
Reputation: 2149
It is very simple, just follow this steps:
IP
address by typing IPCONFIG
command in command
prompt.IP
address from the list which is under the wifi configuration area.IP
Address.Upvotes: 3
Reputation: 2747
If you are using ubuntu please go through this to find your local IP Address on the network and append it to the url instead of local host . worked for me
Eg :http://192.168.1.10/qrstuff/json/
Upvotes: 1
Reputation: 1534
ifconfig
in terminalipconfig
in cmd`sudo ufw disable
in terminalUpvotes: 20
Reputation: 397
its very simple , - GOTO command line (Window + R [type cmd]) - type ipconfig , that will show the current IP address of your PC - write taht IP address on your Android Phone's browser with :80 e.g (http://192.168.x.x:80)
Done
localhost will appear on your Phone
Upvotes: 37
Reputation: 4651
USB doesn't provide network to mobile device. If it's connected to your wifi, then hit your laptop address provided by the router. If it's connected to your mobile network, then first find out your router external IP address, then forward some port to that 10.0.2.2:portno and finally you'll be able to see that server from your device.
or this:
It is very simple
Turn on Wifi Hotspot of your android phone and connect your Laptop with your phone.
Start your server at localhost (I am using wamp server)
Now open command prompt and enter ipconfig command you will get following things
Wireless LAN adapter Wireless Network Connection: Connection-specific DNS Suffix . : Link-local IPv6 Address . . . . . : fe80::80bc:e378:19ab:e448%11 IPv4 Address. . . . . . . . . . . : 192.168.43.76 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.43.1
Copy this 192.168.43.76 in your mobile browser.
Note : Please set you network as "Home Network".
please use the search next time.
Upvotes: 7