Nitroware

“Where a new invention promises to be useful, it ought to be tried” – Thomas Jefferson

Unofficial Guide for a Fully Functional Web Server on iOS

I have found a reasonably good guide to making your iPhone iOS device into a Apache HTTPD server, and I will be updating this page as time goes on. This is only missing MySQL, and preferably a more native build of apache.

First off, make sure you have jailbroken your iPhone iOS device, and have installed the app installer. Make sure you have the Community Sources installed or you will not be able to install Apache HTTPD server or PHP.

Installation of Apache

This is pretty painless.

First, install from the app installer the apache package. Once installed it will look as though nothing was installed (There is no icon added to the app list).

Reboot your iPhone iOS device, and open a safari window.

Type: http://127.0.0.1/

You should be greeted with an apache welcome screen! Congratulations, you now have Apache on your iPhone iOS device!

Installing and Configuring PHP

Installing PHP is a bit tougher but its not that bad.

    1. Download the package through the App Installer, after installation it will give you the path to PHP. It should read: /opt/iphone/bin
    2. Using winscp, or another sftp client ftp into your iPhone iOS device (You should be able to do this if you have setup the ssh/sftp for jailbreaking in the first place). Open the following file for editing: /etc/httpd/httpd.conf.Once you have the conf file open search for:

      Somewhere within this if add the following (I added it to the end right before the endif)

      Code:
      ScriptAlias /php /opt/iphone/bin
      AddType application/x-httpd-php .php
      Action application/x-httpd-php "/php/php-cgi"
      Save the conf file and reupload it.

    3. Now using your sftp client download and edit /etc/profileAdd the PHP Path to the path details, after your done the PATH line should read:

      Code:
      PATH = "/bin:/sbin:/usr/bin:/usr/local/bin:/usr/sbin:/opt/iphone/bin"

    4. Create a php file on your pc named index.php and add the following code to it:Code:
    5. Upload this file to Library/WebServer/Documents/. This is your apache web directory for your new server.Restart your iPhone iOS device again.
    6. Fire up Safari again, and this time navigate to: http://127.0.0.1/index.php

You should now see a php information page with details about your PHP build information! Congrats, you now have a functioning Apache Webserver with PHP scripting Support on your iPhone iOS device! How cool is that?

For those who like commands

For those who like commands, heres some basic commands to run your server through shell.

Download Term-vt100 through the installer app – The best shell app for the iPhone iOS device.

Use the following commands to do various things to your server:

apachectl start ->This starts the apache service and loads the httpd.conf file.

apachectl restart -> This reloads the apache service, and will reload the httpd.conf file. Useful if you make changes on the go and wish to restart apache without having to reboot.

apachectl stop -> Stops the apache server.

I hope it all works for you, if not please let me know and I will fix the tutorial, It is however working fine for me! Goodluck!

More forum content related to iphone apache server:


Categorised as: Apache, Guides, PHP


4 Comments

  1. RecoTile says:

    Are there any details guide to get the “Community Sources and Apache HTTPD server or PHP” installed to the iOS device? (not able to get any “Source path”)

    “First, install from the app installer the apache package. Once installed it will look as though nothing was installed (There is no icon added to the app list).”
    What do you mean by “app installer the apache package”?

    Thanks.

    • nitrx says:

      I have been trying to figure that out myself. The one compiled version of apache I could find was from 2007 (approximately 1.3.7) so I am going to focus my efforts on compiling a newer version.

      Same with php.

      Does anybody have any experience compiling apache from source?

  2. Haitham says:

    Where can I get the app installer. I have searched all over the web for it, and each page takes me to another, and another… is there a trust worthy resource to download this app? Thanks! :)

    • Clesio says:

      Installer died once cydia was born… It’s a piece of history nowadays, anyway I think you can still search for the apache package to try installing by terminal/ssh

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>