This was one of my first popular iPhone/Tech posts… Reposting it now about 16 years later. 🙂 

Over the last month or so that I’ve had the iPhone, I have enjoyed just the original base features included with it. But, being the geek that I am, I had to extend it further… Much further.

A week or so ago, I went ahead and decided to do my “first” hacking of the iPhone. I went to the website and followed the simple instructions and the which is basically a “one touch” utility to install 3rd party apps and Linux ports such as PICO/nano and a terminal program.

I was a bit surprised to find a port of Apache 1.3.37 and PHP 5.2.3 in the repository, so I went ahead, installed them both and with a little configuration using PICO/nano (after installing and logging in through SSH), got a functional web server with PHP support.

I created a PHPINFO() page which shows the extensions that are activated by default, which are pretty much just the core PHP functions and started thinking what to do with it…

Of course I could use it for impromptu testing of code from anywhere, showing simple mockups offline to clients one-on-one, and other things like that, but it wasn’t enough for me…

I put the thoughts on the backburner for a few days and last night I figured I’d try something new.

Here goes…

Apache/PHP was working so I decided to go ahead and copy a full PHP site with full graphics and a PHPMail script on it.

To get this all over to the phone, I TAR’ed up just the most necessary files, filtering out anything not directly referenced (limited amount of memory on the phone for this type of stuff).

Then I FTP’ed, using NCFTP installed from the Installer.App repository, into the machine that had the TAR, downloaded and unTAR’ed it into Apache’s document folder (/Library/WebServer/Documents).

At that point, once all the files were in the correct place and so forth, I hit the website directly on the phone ( and it came right up and was rather speedy. I then hit it from a workstation on the same WiFi network using the DHCP assigned IP and it came up perfectly.

Ok, so far so good. The website comes up just fine locally and remotely, lets take it a few steps further.

I decided to from work today to VPN, using PPTP built into the iPhone, into my DD-WRT router at home (It had a static IP) and then proceeded to port forward port 80 from the external IP to the Internally assigned VPN IP of the iPhone. Then I proceeded to add an external DNS entry for it. Changing my A record from a “REAL” server IP to my home IP redirecting to my iPhone. Which was at work with me, connected to home via VPN and so on. Quite a connection. 

I also tested VPNing into the DD-WRT router over EDGE (Pre-3G) and it worked just fine as well. Of course it was MUCH slower, but still worked fine.

It really was this easy to do something that I don’t think has ever been done before with a cellphone. (At the time of this article)

NOTE: Apache was setup to just start 1 httpd instance and I believe a max of 7, which slowed stuff down a lot with a graphical site, so I set it from 1 to 10.

If anyone has questions, feel free to leave a comment and I’ll reply as soon as I can.