We put PHP on iPhone

    The question immediately arises of why this is necessary. And immediately the answer: just indulge. But as 2 use cases:
    1) Carry a site that is always with you to show someone.
    2) Software development for the iPhone itself in conjunction with PhoneGap. PhoneGap is an SDK for developing applications on JS using an accelerometer, GEO location, etc. That is, instead of Objective-C, we can use JavaScript. And AJAX. And PHP / Python / Ruby.
    This will be uncircumcised PHP, with one exception: in the form of a DBMS, only sqlite can be used here (including through PDO).
    Here's how it will look in the end:

    And one more thing : you can install Python and Ruby with PHP. And here it is not far from Django (I don’t know about ROR).
    Let's proceed with the installation.

    First you need an iPhone with firmware 2.2.1 (this is the last one at the moment) and Wi-Fi on a computer / laptop.
    1. First, you must complete the unlock procedure for the phone with the installation of Cydia.
    2. Install OpenSSH via Cydia. Now we can connect to the phone via ssh and sftp. I use putty and FileZilla for these purposes.
    3. Connect to the phone via ssh. The password is “alpine” (German skier), install PHP and lighttpd (apt-get install php lighttpd), but this can also be done through Cydia. Create the directories / var / log / lighttpd and / var / www (mkdir / var / log / lighttpd && mkdir / var / www)
    4.You need to create a configuration file. You can use vim / mcedit (I think it’s clear how to install) from the console, or you can upload it via sftp.
    The config should have the name /etc/lighttpd.conf, the config itself is here .
    5. We start lighttpd. To do this, execute the command lighttpd-angel -f /etc/lighttpd.conf
    6. To kill the daemon, you need to execute killall lighttpd
    7. You can automate the start / stop of the server through BossPrefs, then the console will not be needed. And you can install MobileTerminal and steer the console directly from the phone. WordPress has



    taken root on iPhone with plugin for sqlite. Just have a small patch to do: append to the beginning of index.php the line “function mysql_connect () {return null; } "

    Also popular now: