PAMP: Personal Apache MySQL PHP - Server Package for Mobile

It is now possible to execute PHP, SQL scripts in your mobile phone!

Those of us familiar with dynamic web programming have most likely heard the term LAMP (Linux, Apache, MySQL and PHP) or WAMP(Windows, Apache, MySQL and PHP). LAMP/WAMP refers to a stack of software used to run a website or server. In LAMP, Apache is the web server, MySQL is the database and PHP is the programming language. Good news is that, as the outcome of the open source research of Nokia PAMP, the AMP stack for Series60 mobile devices is now available. Now a Series60 device can be turned into a web server - LAMP users can publish their PHP sites on their mobile devices which can be accessed from anywhere in the world.

The PAMP Stack

In the Symbian Series60 environment the AMP stack is implemented over Open C. Open C is a set of industry-standard POSIX and middleware C libraries for S60 on Symbian OS. In PAMP, PHP and MySQL are both version 5.

Installing PAMP

The pre-requisite for running PAMP is a Symbian Series60 3rd edition handset having 128MB of free RAM. As per the PAMP wiki they have tested with Nokia N95 8GB and Nokia E90. But any S60 3rd edition phone with sufficient memory should work. (I used Nokia N95 8GB (thanks to Mr. Benjamin Allen H. Burgos III)).

The PAMP installation package (the one I used and test-run) can be downloaded here.

You should install the following files contained in the package (just hit "yes" for some security prompts):

1. pips_s60_1_2_SS.sis
2. openc_ssl.sis
3. PythonForS60_1_4_1_3rdEd.sis
4. PythonScriptShell_1_4_1_3rdEd.sis
5. pamp_with_htdocs_on_...sisx


NOTE: To avoid "Certificate Errors", move your date back to year 2008 (In my case, I moved the phone's date to November 2, 2008).




Figure 1: PAMP Installed


The installation will then create the following new directories:

* c:\data\apache - the ServerRoot of Apache httpd.
* c:\data\php - the location of PHP's ini file.
* c:\data\mysql - the location of MySQL's configuration file.
* c:\mysql - the location of MySQL databases.
* e:\data\apache\htdocs - the DocumentRoot of Apache httpd (In WAMP, this is your www directory).

NOTE: DocumentRoot is always on E:, so you cannot install PAMP on a device that lacks a memory card. However, after the installation, DocumentRoot can be made to point elsewhere.

Building a Network of Connectivity/Creating a LAN


This is an optional thing for you to do as I've found out that this is only a need if you're to manipulate your databases residing on your phone using your laptop via Ad-Hoc network. Importing your databases to your phone's memory (c:\mysql ) simplifies the task. A detailed description on connectivity can be found here.

Running the PAMP


Step 1: Start PAMP, MySQL, Apache



You PAMP should look like this:




(Note: I was able to setup my WLAN and so I've got this IP:169.254.185.141)


Step 2: Let's Test ....

Using the phone's native browser or Opera Mobile 10, browse to http://127.0.0.1 or http://localhost/. You should be greeted with a page that says It works!.

For Default Browser...





For Opera Mobile 10...





Step 3: View phpinfo.php file



Run More PHP Scripts


There are a number of FREE html/php editor for mobile flooded in the internet today, but LCG X-plore should still do.

Step 1: Create hello.php file



Step 2: Save the file. Make sure to save hello.php file under e:\data\apache\htdocs\ directory.

NOTE: Saving the file as Unicode doesn't work. So make sure to uncheck Save as Unicode.

Step 3: Run...




That's it...