1. Zacko's Avatar
    There is both Apache and PHP available for the iPhone. Does anyone know how to set this up all the way so that you can run PHP on the installed Apache server?

    Currently I can install both. Get to http://localhost/ and put pages there. But how do you get PHP to run on there? After installation of PHP, a message prompts you to create '/opt/iphone/bin/' in '$path' (I think that is correct). I am not sure how to create this, I am thinking something to do with using a terminal client or maybe SSH into the iPhone?

    After the creation of that directory, does PHP then run on the Apache server?

    I would think that the possibilities to create local running applications would be great! Including maybe a simple wiki using XML! I would guess that running MYSQL or something to that effect would really cause performance issues, but who knows.
    2007-09-16 10:34 PM
  2. chrisjon's Avatar
    There is both Apache and PHP available for the iPhone. Does anyone know how to set this up all the way so that you can run PHP on the installed Apache server?

    Currently I can install both. Get to http://localhost/ and put pages there. But how do you get PHP to run on there? After installation of PHP, a message prompts you to create '/opt/iphone/bin/' in '$path' (I think that is correct). I am not sure how to create this, I am thinking something to do with using a terminal client or maybe SSH into the iPhone?

    After the creation of that directory, does PHP then run on the Apache server?

    I would think that the possibilities to create local running applications would be great! Including maybe a simple wiki using XML! I would guess that running MYSQL or something to that effect would really cause performance issues, but who knows.
    Yeah - I have exactly the same problem with PHP and Apache. I've been looking at the Apache httpd.config file and trying to put in the directives for the PHP path etc - but as yet no joy. Does anyone know how to do this or where we can find documentation on getting php up and running on the iphone?

    Here's what I added to the end of the .config:

    <IfModule mod_php5.c>
    php_value include_path ".:/opt/iphone/bin/"
    php_admin_flag safe_mode on
    </IfModule>
    <IfModule mod_php4.c>
    php_value include_path ".:/opt/iphone/bin/"
    php_admin_flag safe_mode on
    </IfModule>
    <IfModule mod_php3.c>
    php3_include_path ".:/opt/iphone/bin/"
    php3_safe_mode on
    </IfModule>

    Still no php!

    Thanks
    2007-09-21 01:59 PM
  3. Zacko's Avatar
    Thanks for sharing my request and needs!

    I think running local PHP sites would be awesome! The first thing I would do is create a much better RSS feed reader (similar in function to the Digg one for iPhone). Also, I would love to implement a personal wiki that is iPhone friendly and I could back up. Being able to access HTML files and PHP files would be great! Of course being able to run some sort of database would really increase functionality, but I would settle for using XML.

    Let's hope someone can help us out!

    THX
    2007-09-21 03:28 PM
  4. Arianiv's Avatar
    As far as I can tell external modules are not enabled on the precomplied Apache install available in installer. Turning modules on is a compliation option.

    I was setting up the httpd.conf file to load the PHP modules and got the error

    "Invalid command 'LoadModule', perhaps mis-spelled or defined by a module not included in the server configuration"

    you can read about it on this page http://www.vttoth.com/loadmod.htm

    So this appears not to be a configuration issue. Apache works fine locally and I can make HTML pages to view on 10.0.1.x, just no PHP ... yet...
    2007-09-30 10:38 PM
  5. Zacko's Avatar
    Thanks for the update! I too can run HTML files no problem, but I wouldn't know where to begin to enable PHP to run. I guess the question is: Why is PHP available as a download if you can't run it? and, How are people using the other available ones (Ruby, Python, etc)?

    thx
    2007-10-01 06:34 PM
  6. Arianiv's Avatar
    Enabling PHP should not be all that complicated, there are a few lines you add to the httpd.conf file. LoadModule, AddModule, AddType. If you read the notes in the httpd.conf file, you will see the locations where you add the lines. PHP, Perl, and other modules may be enabled at runtime in this manner, simply requiring a soft restart of the webserver.

    You can find documentation on the web for the syntax of these entries, which vary per platform (windows, OSX, for example, use slightly different filenames.)

    I had located where the PHP files were on the iphone (opt/iphone/bin) and had attempted to load that as a module (the version is PHP 5.x...).

    This is where I ran into the error mentioned above, seemingly that the Apache install provided does NOT have module support compiled in.

    Next step would probably be to contact the folks who provided the install, and request a version with dynamic module support enabled. My intuition tells me just downloading an uncompiled version of Apache and attempting to compile it on the iPhone would not work...
    2007-10-01 07:33 PM
  7. joejoe123's Avatar
    Source:
    Chinese Found:
    http://blog.ilovo.com

    Google Translated:
    http://translate.google.com/translat...language_tools

    Step1:
    Install Apache and PHP using Installer.app

    Step2: (follow the guide below)
    IPHONE PHP configuration in the environment

    open the document for editing / etc / httpd / httpd.conf file, search <IfModule mod_alias.c> ... .. </ IFModule>, in this intermediate type:


    ScriptAlias /php /opt/iphone/bin
    AddType application/x-httpd-php .php
    Action application/x-httpd-php “/php/php-cgi”


    Then edit /etc/profile document, the path to PHP foisted PATH:

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


    Resuming APACHE servers through SSH command (in WINSCP) input: apachectl restart

    enjoy it. Enjoy it.
    2007-10-10 09:14 PM
  8. Zacko's Avatar
    Wow, nice find. Have you done this? Do you know if it works? To be honest with you, its a bit over my head. I program PHP and other web based markup/programming languages, so I usually leave the config stuff to the Admins However, I may just give it a try and hope I don't end up with a Restore scenario.

    Thanks for the find, top notch. Chinese, who knew?!
    All Your Base Are Belong To MMi!
    2007-10-11 02:18 AM
  9. c1oUd's Avatar
    Take a look at:

    http://www.touchdev.net/wiki/PHP_APA...ion_iPod_touch

    Tested on iPod Touch 16GB

    Attached: My working httpd.conf & profile files.
    Attached Files
    2007-10-14 04:06 AM
  10. dutchy's Avatar
    Hi,
    maybe i am blnd, but i can't find the file etc/proflie:-(
    is there another way to run php?

    greetings
    dutchy
    2007-12-23 07:01 PM
  11. Nefarious's Avatar
    Just what I was looking for. Worked like a charm.
    2008-01-12 06:19 PM
  12. alexshelkov's Avatar
    I did this:
    Step1:
    Install Apache and PHP using Installer.app

    Step2: (follow the guide below)
    IPHONE PHP configuration in the environment

    open the document for editing / etc / httpd / httpd.conf file, search ... .. , in this intermediate type:

    ScriptAlias /php /opt/iphone/bin
    AddType application/x-httpd-php .php
    Action application/x-httpd-php “/php/php-cgi”

    Then edit /etc/profile document, the path to PHP foisted PATH:

    PATH = "/bin:/sbin:/usr/bin:/usr/local/bin:/usr/sbin:/opt/iphone/bin"
    But then i try open script error occured(Internal Server Erorr: The server encountered an internal error or misconfiguration and was unable complite your request).
    I have 1.1.2 firmware, Apache ver: 1.3.37-2, PHP: 5.2.3-2.
    2008-01-22 05:19 PM
  13. puzzledk's Avatar
    Running PHP is cool, but I'm trying to find a way to enable PHP to use cURL. Anyone got any idea? cURL seems to be working fine from the terminal, so it's only a matter of configuration. In Windows I used the php.ini but here is more complicated.
    2008-05-06 03:48 AM
LINK TO POST COPIED TO CLIPBOARD