views:

164

answers:

3

Hi all,

I'm trying to test my iPhone application on the device. I have a mac computer which stores my development environment. Right now I can only access PHP files using the http://localhost/PHPFileLocation which does not work when I try to test my app on real device.

How do I configure apache2 to be accessible from outside? Is it possible to configure it to a specific IP address?

I want to reach some php scripts located on my development machine running apache2 from my iPhone device.

Thanks

A: 

If your computer has a WiFi card then you should be able to attach the iPhone remotely to a ad-hoc Wifi network created on your dev machine.

djangofan
A: 

I'm assuming your Mac is behind a router. You should be able to configure your router to port forward connections to your WAN facing IP address to port 80 (the HTTP port) on your Mac - see http://portforward.com/ for some help.

You may also need to turn the firewall off on your Mac.

Once this is set up correctly you can hit http://yourexternalIP/PHPFileLocation in your iPhone app and this will be directed by your router to the Apache2 server on your Mac. The external IP is normally found on your router's admin page somewhere.

Robert Conn
I tried this option but no success.I noticed that even http://127.0.0.1/PHPFileLocation did not work.Only the localhost option was working...What else should I try?
embedded
This is the error message I'm getting:404 Not FoundFile not found. micro_httpdDoes anyone know how to resolve this?
embedded
404 means that the Apache server is alive and your requests are getting to it. The resource (seems like a PHP file in your case) does not exist in the correct location. Check you have your code in right place. The root of the web server public area is generally the htdocs folder.
Robert Conn
A: 

Right now when I'm using the localhost option the root of the web server is located at the /Users/username/Sites folder.

so now when trying to reach a resource file from the outside I should place my files at the htdocs folder?

Thanks

embedded