FORUMS
Remove All Ads from XDA

[APP] php 5.4.2 + lighttpd 1.4.29 in FCGI mode, crosscompiled for ARM

419 posts
Thanks Meter: 406
 
By viulian, Inactive Recognized Developer on 30th August 2011, 08:53 PM
Post Reply Email Thread
Update 7 May 2012: New version released, containing PHP 5.4.2 with curl / openssl modules built in (still for armv5). Besides the version number, installation steps remain the same.

Introduction

The web page of the project, containing more information, licenses, configuration fils, list of modules for php and lighttpd, etc is here:
http://hex.ro/wp/blog/php-and-lighttpd-for-android/

It also contains and example, how to install SMF forum onto the phone

Download

This comes with NO WARRANTY. Use it at your own risk!

php-5.4.2_lighttpd_1.4.29_armv5.tar.gz

php-5.3.8_lighttpd_1.4.29_armv5.tar.gz

Installing

After you copy the archive above into the root of your SD Card, installation is easy:

Code:
cd /
tar xf /sdcard/php-5.3.8_lighttpd_1.4.29_armv5.tar.gz
reload-fcgi.sh
reload-lighttpd.sh
Make sure you are on the root file system (/) before executing tar command.

Also, mandatory: rooted phone + busybox + /system partition mounted read only.

Below information is older - which was before the bundle was ready

Coming soon:

(excerpt from phpinfo() now running on my phone)

PHP Code:
System         Linux localhost 2.6.32.9-perf #1 PREEMPT Fri Jul 8 13:45:08 2011 armv7l
Build Date     Aug 30 2011 22:07:32
...
PHP Version                        5.3.8 
...
Server API                            CGI/FastCGI
Virtual Directory Support            disabled
Configuration File 
(php.iniPath    /system/etc/php
Loaded Configuration File            
/system/etc/php/php.ini 
...
_SERVER["_"]    /system/bin/php
_SERVER
["FCGI_ROLE"]    RESPONDER
_SERVER
["SERVER_SOFTWARE"]    lighttpd/1.4.29
_SERVER
["SERVER_NAME"]    192.168.1.3
_SERVER
["GATEWAY_INTERFACE"]    CGI/1.1 
I have managed to compile lighttp 1.4.29 with fcgi support as well as php 5.3.8 (both latest version).

All graphics libraries are in as well as SQLite.
I will still have to play with OpenSSL to get it running. Maybe MySQL in the future

It will take a while to set everything up (a web page for source code, wiki on how to install), but we're close to have a fuller Linux experience on Android powered phones.
The Following 8 Users Say Thank You to viulian For This Useful Post: [ View ] Gift viulian Ad-Free
 
 
31st August 2011, 04:52 AM |#2  
Member
Thanks Meter: 10
 
More
This would be amazing, I've been hoping for something like this.
2nd September 2011, 10:21 AM |#3  
Adolf1994's Avatar
Senior Member
Flag Fertőrákos
Thanks Meter: 66
 
More
wow, I'm really looking forward this
It's cool to have this functionality, cuz sharing files via BT is a pain the ass
4th September 2011, 04:10 PM |#4  
Senior Member
Flag Warsaw
Thanks Meter: 301
 
More
I'm waiting too. And wish you luck. Thanks for the efforts.
5th September 2011, 06:54 AM |#5  
OP Inactive Recognized Developer
Thanks Meter: 406
 
Donate to Me
More
Thank you for the kind words

Yes, everything works now, and I've tried out a PHP gallery as well as PHP file editor (so you can edit .php files within Opera connected to local host).

It works. Unfortunately, on my Arc, it takes about 3 seconds to generate a thumbnail of a camera image. Now I understand why the whole thing with Media Server indexing files first time after reboot, when phone is slow and etc .. and why the need that apps have to notify Media Server to index additional files when apps create them. So by the time user gets to open the gallery, their thumbnails are already there (it masks the delay).

I want to try out more scripts and then create an installer for the whole thing. If members here report it works, then I will upload it to the market.
6th September 2011, 09:02 PM |#6  
Adolf1994's Avatar
Senior Member
Flag Fertőrákos
Thanks Meter: 66
 
More
I think I will try a bunch of forum engines.
How many additional modules will there be? ImageMagik is really useful… or at least GD

EDIT: ohh, didn't see OP says all graphic libraries included (^_^; )
7th September 2011, 11:13 AM |#7  
Senior Member
Flag Warsaw
Thanks Meter: 301
 
More
Quote:
Originally Posted by viulian

Thank you for the kind words

We should thank you for your efforts. And we are.

Quote:
Originally Posted by viulian

I want to try out more scripts and then create an installer for the whole thing. If members here report it works, then I will upload it to the market.

You can count on me. I'm not a full time PHP developer, but I wrote few little "systems" in "my way" so it should test non-standard approach at least. but I believe you've already tested basic PHP behaviour

By the way - you mentioned something about mysql... I would personally prefer PostgreSQL, but I do not know anything about a way it's written so theoretically it can be harder to move to arm platform. Postgres is more flexible in many ways, and sometimes (I've heard) a way faster because of simplicity of mysql.

But if anything will be problematic with sql, I can always fall back to sqlite
9th September 2011, 05:45 PM |#8  
OP Inactive Recognized Developer
Thanks Meter: 406
 
Donate to Me
More
Update:

libcurl won't be bundled (PHP will be compiled without --with-curl argument).

It seems that libcurl has a dependency on libc - and it tries to load libc.so causing php executable to crash.

Output from strace:

Code:
open("/system/lib/libc.so", O_RDONLY)   = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=273912, ...}) = 0
close(3)                                = 0
--- {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0xfde0004} (Segmentation fault) ---
+++ killed by SIGSEGV +++
Segmentation fault
10th September 2011, 07:27 AM |#9  
Adolf1994's Avatar
Senior Member
Flag Fertőrákos
Thanks Meter: 66
 
More
that's really sad. cURL is sooo cool. (´Д`)
but so far you always found a way to make things work and I hope the same will apply to this as well.
If you have an idea that would work, then will this released later? or you let us play with the cURL-less boundle?
12th September 2011, 11:42 AM |#10  
Senior Member
Flag Warsaw
Thanks Meter: 301
 
More
I won't mind lacking of cURL. We have wget onboard for simple downloads. For more sophisticated actions android isn't the best platform
16th September 2011, 12:56 PM |#11  
OP Inactive Recognized Developer
Thanks Meter: 406
 
Donate to Me
More
Here's the info.php generated using lighttpd / php statically built for Android:

info.php.zip

I've been on a trip with limited access to internet, and so far I managed to find a fix for lighttpd which, when statically built, would not load the modules in the correct order. It was a mess to use I've documented it here: http://redmine.lighttpd.net/issues/2343

ImageMagick is not ported yet (just standard gd as you will see). I'm tempted to port ImageMagick also, since it seems that batch operations are faster with it than with the built in gd (and on my Arc, generating the thumbnail of a camera taken photo takes about 3 seconds, which is slow).

So far I've tested fotogallery and monoedit (to edit php files on the phone using any browser) and they work fine.

Please expect updates soon.
The Following User Says Thank You to viulian For This Useful Post: [ View ] Gift viulian Ad-Free
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes