Apache-MySQL-PHP on my phone, and it wasn't even hard
Holy cow... It really works!! (Just like they promised!)
About the same day as I signed the contract to work for MySQL AB, Nokia Research Center announced that they had ported MySQL (and Apache, and PHP, Python was there already earlier) to the Symbian platform. And about the same day I would start working they also released the code to download. This was of course really cool, but the perfect timing had another great advantage: Since PAMP - as it is called - will only run on some of the biggest and most expensive Nokia phones, it gave me a good argument that my manager had to approve buying a E90 and not any other average phone. (Which was great, I'm so a qwerty fan for phones.)
But today, half a year later I actually got that installed on my phone. While I am indeed the MySQL Telecom Sales Engineer for Finland, I mostly sell large MySQL Cluster or datawarehousing installations, this is probably as far from that as you can get MySQL-wise, so I always had more important work to do1. I also had somehow thought that it was available in source only, and I would have to boot into Windows, install Carbide, compile, curse, compile again and then realise that I have problems signing the packages correctly and not be able to install it. Not so: there are SIS files to download and it takes 1-2 hours to have a full PAMP+Python stack running on the phone!
To finalize the installation I also did as instructed:
Smoke test 1: Start PAMP utility to start Apache and MySQL. Start web browser on phone and enter 127.0.0.1 as the URL. I got to the "It works" page and then to the PHP info page which is shown on the picture.
Smoke test 2: Connect to WLAN, find out your IP address from the PAMP utility and enter it in a browser on your PC. It works too! (as you already saw too).
Smoke test 3:
hingo@hingo-mysql-kub:~$ mysql -h 192.168.103 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.0.45 Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | +--------------------+ 2 rows in set (0.12 sec) mysql> show variables; +---------------------------------+-----------------------------+ | Variable_name | Value | +---------------------------------+-----------------------------+ | auto_increment_increment | 1 | | auto_increment_offset | 1 | | automatic_sp_privileges | ON | | back_log | 50 | | basedir | c:\mysql\ | | binlog_cache_size | 32768 | | bulk_insert_buffer_size | 8388608 | | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | latin1 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | latin1 | | character_set_system | utf8 | | character_sets_dir | c:\mysql\share\charsets\ | | collation_connection | utf8_general_ci | | collation_database | latin1_swedish_ci | | collation_server | latin1_swedish_ci | | completion_type | 0 | | concurrent_insert | 1 | | connect_timeout | 5 | | datadir | c:\mysql\data\ | | date_format | %Y-%m-%d | | datetime_format | %Y-%m-%d %H:%i:%s | | default_week_format | 0 | | delay_key_write | ON | | delayed_insert_limit | 100 | | delayed_insert_timeout | 300 | | delayed_queue_size | 1000 | | div_precision_increment | 4 | | engine_condition_pushdown | OFF | | expire_logs_days | 0 | | flush | OFF | | flush_time | 0 | | ft_boolean_syntax | + -><()~*:""&| | | ft_max_word_len | 84 | | ft_min_word_len | 4 | | ft_query_expansion_limit | 20 | | ft_stopword_file | (built-in) | | group_concat_max_len | 1024 | | have_archive | NO | | have_bdb | NO | | have_blackhole_engine | NO | | have_compress | YES | | have_crypt | YES | | have_csv | NO | | have_dynamic_loading | YES | | have_example_engine | NO | | have_federated_engine | NO | | have_geometry | YES | | have_innodb | NO | | have_isam | NO | | have_merge_engine | YES | | have_ndbcluster | NO | | have_openssl | NO | | have_ssl | NO | | have_query_cache | NO | | have_raid | NO | | have_rtree_keys | YES | | have_symlink | YES | | hostname | localhost | | init_connect | | | init_file | | | init_slave | | | interactive_timeout | 28800 | | join_buffer_size | 131072 | | key_buffer_size | 16384 | | key_cache_age_threshold | 300 | | key_cache_block_size | 1024 | | key_cache_division_limit | 100 | | language | c:\mysql\share\english\ | | large_files_support | ON | | large_page_size | 0 | | large_pages | OFF | | lc_time_names | en_US | | license | GPL | | local_infile | ON | | log | OFF | | log_bin | OFF | | log_bin_trust_function_creators | OFF | | log_error | | | log_queries_not_using_indexes | OFF | | log_slave_updates | OFF | | log_slow_queries | OFF | | log_warnings | 1 | | long_query_time | 10 | | low_priority_updates | OFF | | lower_case_file_system | ON | | lower_case_table_names | 1 | | max_allowed_packet | 1047552 | | max_binlog_cache_size | 4294967295 | | max_binlog_size | 1073741824 | | max_connect_errors | 10 | | max_connections | 100 | | max_delayed_threads | 20 | | max_error_count | 64 | | max_heap_table_size | 16777216 | | max_insert_delayed_threads | 20 | | max_join_size | 4294967295 | | max_length_for_sort_data | 1024 | | max_prepared_stmt_count | 16382 | | max_relay_log_size | 0 | | max_seeks_for_key | 4294967295 | | max_sort_length | 1024 | | max_sp_recursion_depth | 0 | | max_tmp_tables | 32 | | max_user_connections | 0 | | max_write_lock_count | 4294967295 | | multi_range_count | 256 | | myisam_data_pointer_size | 6 | | myisam_max_sort_file_size | 2147483647 | | myisam_recover_options | OFF | | myisam_repair_threads | 1 | | myisam_sort_buffer_size | 8388608 | | myisam_stats_method | nulls_unequal | | net_buffer_length | 2048 | | net_read_timeout | 30 | | net_retry_count | 10 | | net_write_timeout | 60 | | new | OFF | | old_passwords | OFF | | open_files_limit | 61 | | optimizer_prune_level | 1 | | optimizer_search_depth | 62 | | pid_file | c:\mysql\data\localhost.pid | | port | 3306 | | preload_buffer_size | 32768 | | profiling | OFF | | profiling_history_size | 15 | | protocol_version | 10 | | query_alloc_block_size | 8192 | | query_prealloc_size | 8192 | | range_alloc_block_size | 2048 | | read_buffer_size | 258048 | | read_only | OFF | | read_rnd_buffer_size | 258048 | | relay_log_purge | ON | | relay_log_space_limit | 0 | | rpl_recovery_rank | 0 | | secure_auth | OFF | | secure_file_priv | | | server_id | 1 | | skip_external_locking | ON | | skip_networking | OFF | | skip_show_database | OFF | | slave_compressed_protocol | OFF | | slave_load_tmpdir | C:\Private\2001842e\tmp\ | | slave_net_timeout | 3600 | | slave_skip_errors | OFF | | slave_transaction_retries | 10 | | slow_launch_time | 2 | | sort_buffer_size | 65528 | | sql_big_selects | ON | | sql_mode | | | sql_notes | ON | | sql_warnings | OFF | | ssl_ca | | | ssl_capath | | | ssl_cert | | | ssl_cipher | | | ssl_key | | | storage_engine | MyISAM | | sync_binlog | 0 | | sync_frm | ON | | table_cache | 16 | | table_lock_wait_timeout | 50 | | table_type | MyISAM | | thread_cache_size | 0 | | thread_stack | 81920 | | time_format | %H:%i:%s | | time_zone | SYSTEM | | timed_mutexes | OFF | | tmp_table_size | 33554432 | | tmpdir | C:\Private\2001842e\tmp\ | | transaction_alloc_block_size | 8192 | | transaction_prealloc_size | 4096 | | tx_isolation | REPEATABLE-READ | | updatable_views_with_limit | YES | | version | 5.0.45 | | version_comment | Source distribution | | version_compile_machine | armv5 | | version_compile_os | Symbian | | wait_timeout | 28800 | +---------------------------------+-----------------------------+ 183 rows in set (0.19 sec) mysql>
Now I just have to figure out something interesting to do2. I could:
- Fiddle with most of the phones data like SMS, Calendar, Notes, Todo.... This I'm interested in, nothing is greater than sending SMS's from a real PC, even if my phone admittedly has qwerty too. Maybe I can even create a calendar interface that will be timezone-aware. (one of my pet peeves, it's really messy to schedule meetings for days that you'll be in another timezone than the current one.)
- I could install Drupal on it. "Just because you can" is of course always a good reason, but I don't really see myself moving my blog to the phone, even if it is online 24/7. (Just imagine it then becoming slashdotted! Poor little phone...)
- But it could be interesting to have a web page that automatically let's you browse and download pictures you've taken.
- I could also see some kind of mini-groupware suite handy. Then you could use your phone as an ad-hoc meeting groupware server, where people could download your slides, write nodes, work in a wiki... You can set the phone in ad hoc WLAN mode, so imagine just walking into a meeting room, people will connect to the phone with their laptops and you have an instant groupware server. You could do this with a laptop too I guess, but hey, you don't always have the laptop in your pocket, the phone you do.
- There is a REST api available, providing access again to SMS, Calendar... including in RSS and Atom formats. This could be an interesting way to access the data too I guess.
- But where would you actually use MySQL? Well, from the above the album app is one I guess, and Drupal of course. One great idea would be to store a log of GPS locations I've been to as well as people I've met - as seen from bluetooth. However, that has already been done.
BTW: When I was following the install instructions, I somehow got the idea that MWS (Mobile Web Server) somehow is an older version and PAMP is the great new stuff, so I installed PAMP standalone. Turns out I was wrong and MWS actually has some interesting features of it's own, including providing a gateway from the public internet to the phone (if that really is something you'd want...). So if you go and try this, you may want to install MWS first and then PAMP on top of it. I may end up re-doing my installation too, one day.
- 1. Standard joke: Of course you probably could run MySQL Cluster on Symbian too, but then you'd need at least 3 phones :-)
- 2. Heh, every single person - I guess including myself) - when hearing that you can now run MySQL and Apache on your phone would instantly ask: Why on earth would anyone want to do that :-)