1

I've been googling this one a lot but I still could not make it work. I have a MAMP web server installed on my mac and I've created some a web service. It work fine when I call it from the browser on my mac when I use localhost:8888/myfile.php and also when I use 192.168.0.108/~martin/myfile.php.

The problem is when I try to call the 192.168.0.108/~martin/myfile.php from my iPhone to do some testing, the requests time out. It is really weird because this was working 2 days ago. I'm not sure what has changed. I'm not very familiar with httpd.conf and htaccess files, but I did not change things there manually.

Any help would be appreciated!

5
  • Is your iPhone connected to your network via WiFi? 192.168.*.* is a private/local IP, not web-accessible.
    – simshaun
    Commented Apr 24, 2012 at 19:39
  • Yes my iphone is connected via wifi on the same network as my mac. The ip of my iphone is 198.168.0.107
    – Mart Coul
    Commented Apr 24, 2012 at 19:48
  • I can't post my answer since it doesn't make enough time i have asked it. I'm pasting my answer here in the meanwhile and will answer the question in 8 hours.
    – Mart Coul
    Commented Apr 24, 2012 at 21:15
  • I finally resolved it. I don't really understand what happened but I'm still posting it in case it can help somebody. I restarted my router and everything went fine afterwards (of course I modified the iP address to match the new address my mac was assigned).
    – Mart Coul
    Commented Apr 24, 2012 at 21:15
  • Wow this is so strange, after hours of trying to figure out what was the problem. I read your comment above and restarted my router. It is working now, so weird! Thanks!
    – Leo
    Commented Oct 22, 2015 at 23:23

4 Answers 4

2

Have you tried going to http://192.168.0.108:8888/myfile.php on your iPhone? If MAMP is running on 8888 you will need to specify the port to access it there.

Be sure to check your computer's IP too. It's possible that it changed over the last few days depending on your router's setup.

Also, make sure the iPhone is indeed on the same network as your local machine. Depending on your network setup, a subnet might not work either. I've driven myself crazy trying to connect to a box that was actually connected on a separate subnet.

6
  • Thanks for the quick feedback. I did a quick check and both my mac and my iphone are on the same subnet. I also did check my ip, I made that mistake couple days ago so... But at the moment the ip of the mac is ok (198.168.0.108).
    – Mart Coul
    Commented Apr 24, 2012 at 19:50
  • Is it possible that your computer has a firewall on it or is blocking incoming connections?
    – saverio
    Commented Apr 24, 2012 at 19:52
  • I also did try to add the 8888 after the ip, but it doesn't work either. Although previously I didn't need that and it was working fine. I'm also testing on my mac and without the 8888 it is working fine. It is only for other devices on the same network such as my iPhone for which it doesn't work...
    – Mart Coul
    Commented Apr 24, 2012 at 19:52
  • The firewall is off, but how can I check if it is blocking other incoming connections?
    – Mart Coul
    Commented Apr 24, 2012 at 19:52
  • I really doubt it's a connection problem. It's more likely that it's a MAMP setup issue, but you could download something like this on your iPhone and try telneting to "192.168.0.108 8888". If you get a connection, you'll know your iPhone can connect to your computer and then you'll def know it's a MAMP issue. Download it from the AppStore here: itunes.apple.com/us/app/mocha-telnet-lite/id286893976?mt=8
    – saverio
    Commented Apr 25, 2012 at 20:39
0

Don't know if this helps anyone but I got this working by simply removing the ip host address and changing this to the wildcard. It started working straight away after this

0

I had success opening my local-folder by opening the host by the computer’s local hostname.

Solution 1: computer’s local hostname

Find your computer’s local hostname: macOS->System Preferences->Sharing->File Sharing https://support.apple.com/et-ee/guide/mac-help/mchlp1177/mac

Near the "Computer's Name" you can find the info:

"Computers on your local network can access your computer at: "mymac.local"

Opening the compuerts name "your_computers_name.local" in iOS-Safari worked for me:

http://[your_computers_name.local]

For example:

http://mymac.local

Solution 2: computer’s network address

Try it with the computer’s network address. If you select and activate file-sharing in the preferences you can find the network address. Looks like: "smb://name.example.com". Replace "smb" with "http".

Open the network address in iOS-Safari (connected via USB-Cable or Wifi):

http://[insert_your_computer_network_address]

For example you can access your files like:

http://name.example.com/myfile.php

This worked for me, too.

As an alternativ way to find the address write "hostname" in terminal of the host-computer:

$ hostname

This will return the host's name / network address.

Doesn't work?

Maybe you have to allow file sharing first? I don't know ...

macOS->System Preferences->Sharing->File Sharing: On

0

The solution for me is to open my firewall and allow all inbound and outbound connection via port 8888 which is the port I used for hosting the local server.

Just make sure that the used port is allowed on your firewall.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.