I have installed apache2 on ubuntu and then using it to setup localhost which although can be accessed on the same computer but not on the android on the same network. I remember i could do this previously but now it isn't happening. I want to send files to my android through localhost quickly. Any solution?
-
1`localhost` refers to the physical device you type `localhost` on, to your phone, localhost it the phone, you your desktop, localhost is the desktop. To connect to your desktop from your phone, you will need to enter in IP address of the desktop. – Matt Clark Jun 07 '18 at 22:15
2 Answers
localhost
is usually just an alias for the loopback address 127.0.0.1
, which means "this computer". So, On your android phone, you are telling it to send this files to "this computer", which is the phone itself. You need the IP address of your local computer, which usually can be found by running ifconfig
from the command line. Depending on your network setup, the output of this will have a bunch of stuff, and you should look through the output for anything that resembles an IP address, usually this is under the en0
or eth0
sections (I'm not a networking expert).

- 889
- 6
- 9
To access the Local server from device you should set the URL IN YOUR code to the local ip instead of 127.0.0.1 CMD>ipconfig> (IPv4 Address. . . . . . . . . . . : 192.168.1.XXX )
then Connect to the same Network and all fine or you can download Xampp as its support Linux OS and will Automatically install needed tools like
Apache2 , Mysql and support MariaDB + PHP + Perl
you can find useful answears in this Thread How can I access my localhost from my Android device? Ask
as its answered before

- 51
- 11