PHP and Lighttpd for Android

Update 7 May 2012: New version released, containing PHP 5.4.2 version (CGI only). It now contains openssl / curl / SQLite modules statically linked within php-cgi executable and thus curlssl works! Beside the version number, all installation instructions below still apply.

If you are already using PHP 5.3.8, just grab the php-cgi file from the 5.4.2 archive system/xbin folder and replace the /system/xbin/php-cgi on the device.


Below you can find an bundle of PHP 5.3.8 (CGI only) and Lighttpd 1.4.29 (FastCGI module included) which are cross compiled for ARMv5 CPUs (Android platforms mainly).

As you mail well know, both PHP and Lighttpd offer modules that could be loaded at run-time based on settings within configuration files. The bundle doesn’t include all modules, due to difficulties encountered when compiling for ARM platforms. Those modules that are included are statically linked in the executables (so no additional files are needed) nor configuration files need to be updated to load them.


Below you can see screenshots with the phone browser opening localhost address. Once you unpack the archive, there’s an index.php file which just calls phpinfo() to show the details about the build.

Of course, you can remove the file and put your own scripts :)

phpinfo() on Sony Arc

phpinfo() on Sony Arc

phpinfo() on Sony X10 Mini

phpinfo() on Sony X10 Mini

PHP Modules

The list of PHP modules that are statically linked:

[root@arc]/sdcard# php -m
[PHP Modules]

[Zend Modules]

Lighttpd Modules



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




Please check README.txt file found in /system/README.txt within the bundle.

PHP executable is offered under PHP license, Lighttpd executable under Lighttpd license, all other files in the bundle are offered under New BSD License (3 clause BSD license).


The bundle tries to mimic as much as possible the layout of a Debian installation of the two files. However, due to file system layout on Android phones (binaries under /system folder), the folders are one step down, under /system folder:

`-- system
    |-- bin
    |   |-- lighttpd -> /system/xbin/lighttpd-static
    |   `-- php -> /system/xbin/php-cgi
    |-- etc
    |   |-- lighttpd
    |   |   `-- lighttpd.conf
    |   `-- php
    |       `-- php.ini
    |-- var
    |   |-- log
    |   `-- www
    |       `-- index.php
    `-- xbin
        |-- fcgiserver
        |-- lighttpd-static
        |-- php-cgi


  • rooted phone with busybox installed.
  • mount the /system partition as RW.

Using DroidSSHd on the phone and connecting with Putty (or equivalent) makes the whole process faster.

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

cd /
tar xf /sdcard/php-5.3.8_lighttpd_1.4.29_armv5.tar.gz

You might notice that the owner / group of the files is 1000:1000. Ignore that, as long as you execute them as root, there’s no issue (those are the IDs of my username on the PC I created the tar.gz archive and tar tries to conserve the user / creation time / etc from when the archive was created).

The last two commands start the FCGI server (PHP with 4 children processes), and then launch lighttpd server as daemon.

The default port is 80.
Default htdocs folder is /system/var/www.

The configuration files are under /system/etc/lighttpd/lighttpd.conf and /system/etc/php/php.ini. To restart either PHP or Lighttpd, please use one of the commands above.

It is mandatory that you are on the root folder when you extract the archive. tar will take care of creating all the missing folders, creating the links, etc, as long as you are on the root folder.

You can now open the phone’s browser and point it at localhost :) and the phpinfo() page should appear.

Example usage

Installing Simple Machines Forum 2.0.1 on Android

Before executing the commands below, you need the “Full Install” smf_2-0-1_install.tar.gz archive downloaded from SMF and then copied onto your /sdcard root folder.

# cd /system/var/www
# ls
# mkdir forum
# cd forum
# tar xf /sdcard/smf_2-0-1_install.tar.gz

Last two commands are optional, if you already started the FastCGI server as well as lighttpd.

You should now connect to http://localhost/forum and finish installation of the forum.

Enjoy :)

Comments (159)

Darkness AngelSeptember 25th, 2011 at 3:10 am


it will make 413 error when try to attatch large file :( (default value is 2GB but your httpd has too small value)

if someone want to increase it

add this lines on your lighttpd.conf
server.upload-dirs=( “/sddata/www/tmp” )

dirs=must same as upload_tmp_dir on your php.ini

EricOctober 12th, 2011 at 7:28 am

Could you let me know how to cross compile it?

viulianOctober 12th, 2011 at 11:13 am

To make a long story short, please start here and compile for ARM (generic ARM).

EricOctober 12th, 2011 at 1:52 pm


I have port it to Androd, but the mod_* is *.so, e.g.
How to build it static, how to link the mod_* all into a singal binary?

viulianOctober 12th, 2011 at 2:20 pm

You need to know scons and use that to compile lighttpd, just patching configure script didn’t work for me. Scons generates more than configure it also generates plugin-static.h file. BUT it generates it badly.

Internally, scons uses a dictionary data structure to store what plugins need to be statically compiled; when it writes out the plugin-static.h file, it doesn’t keep the correct order (since dictionaries in Python are not ordered). I’ve described the bug here:
Please read the description and solution there. You still need to edit the plugin-static.h file per description above.

:) Hope it helps…

Also, I found it helpfull to work with the ldd command (built for your target) as well as strace on the phone itself.

EricOctober 12th, 2011 at 3:16 pm

Thanks so much!!! It’s very helpful.

A Couple Android Magic TricksOctober 13th, 2011 at 6:36 pm

[…] versions. Note that Macs can also climb onto an SMB share.Here’s something really impressive. Viulian over at XDA has managed to get Lighttpd, PHP5 and Sqlite3 (with support for MySQL and PostgreSQL. […]

phpdevloperOctober 17th, 2011 at 3:48 pm

There are no binaries included.

viulianOctober 17th, 2011 at 4:01 pm

@phpdevloper – where did you look for them :) ? They are there, please check /system/xbin folder in the archive.

phpdeveloperOctober 17th, 2011 at 7:49 pm

@viulian: I got it it was symlinked.

But now I am finding out to get it at work, I got a 503 error because of port 9001.

2011-10-17 17:39:05: (src/log.c.166) server started
2011-10-17 17:39:27: (src/mod_fastcgi.c.2904) establishing connection failed: Connection refused socket: tcp:
2011-10-17 17:39:27: (src/mod_fastcgi.c.2910) backend is overloaded; we’ll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 1
2011-10-17 17:39:29: (src/mod_fastcgi.c.2852) fcgi-server re-enabled: tcp:

phpdeveloperOctober 17th, 2011 at 8:34 pm

Works fine but some PHP sites run very slowly (20 seconds or more to load page). I use lots of regexp thay maybe the problem ?
On other devices I used lighttpd as well with success : the Nokia N810 and iPad 2 (the latter I stell have).

viulianOctober 17th, 2011 at 8:53 pm

1. It is compiled for ARMv6 without FPU support (so it should be slow for math operations). Dunno about regexp – but it might be that they are slow too ?
2. I also noticed that if processing is involved, phone tends to be slow. I put in some -O3 optimisations and so on, but since it is not using any advanced ARM instructions (but generic ARM) it might be the reason why it is slow.

I will try to compile these days using ARMv7 (since the goal was to have a release that runs on many phones), and also fix the system bug (PHP has the /bin/sh path hardcoded) – and will post an update. But probably towards the end of the week.

phpdevloperOctober 18th, 2011 at 8:59 am

Thanks ! Well done !
And I also had to change the paths as the /system partition is nearly full (rooted Galaxy S2 with Busybox), so I put the logging, configs and the php (10MB) and lighttpd binaries on the /data partition which also has the advantage of reverting the /system partition readonly after installing.
Even on a ‘normal’ unrooted Galaxy the /system partition is nearly full.
I symlinked the htdocs (var/www) to a user-accessible folder on /mnt/sdcard.

phpdevloperOctober 18th, 2011 at 11:10 am

@Viulian: If you are interested in a test script you can send me an email (email address is logged here).

phpdeveloperOctober 18th, 2011 at 9:15 pm

After some research, the slowness of my sites running on your PHP / lighttpd is not your server software, but a bug in Android / busybox which does not resolve hostnames. That results in that the PHP gethostbyname() function waits for 10-20 seconds which makes the webserver seemingly slow.
The same issue occurs when you open a terminal to a rooted Android device, (e.g. via ssh) and then run “ping” or “wget” which result in “Bad address”.

I think your compiled version can even run on non-rooted devices, as long the software is installed on user-accessible folders such as /mnt/sdcard, and therefore no symlinks are used (this is a FAT filesystem). Maybe /data/data can be used as well because this folder is ext3 and thus does allow symlinks and running shellscripts. E.g. the sshdroid app from the Market has a ‘busybox’ which can be used on non-rooted devices. Moreover the port number should be above 1024. That is all.

@viulian if you have questions, feel free to mail me.

viulianOctober 20th, 2011 at 10:20 am

@phpdeveloper – thank you for all the feedback :) I was busy these days.

I did not want to make a complex installer (messing with SD Card, partitioning and so on) so that the PHP is available for most phones out there.

So far the requests were about startup scripts as well as being able to locate it somewhere else. I have the installer that installs Midnight Commander, and I will probably update it to install all the apps that I’ve manage to cross-compile. One of the options would indeed be where to extract all the archives (but if you won’t use /system/xbin – then probably it’s up to the user to add the PATHs to the environment, etc).

RafaelOctober 25th, 2011 at 8:40 pm

When I try to untar the file on my phone it says “tar: invalid tar magic”.
what do i do?

viulianOctober 26th, 2011 at 7:13 am

What extraction command are you using ?

With a version of busybox that I have tar xf does the job.

viulianDecember 6th, 2011 at 12:20 am

system(…) but is fixed!

Actually, even if PHP has /bin/sh hardcoded within proc_open.c, it seemed not used in case of system/exec. It is in fact delegating to the underlying libc , by using the standard system() call of libc. I have recompiled the libc with the /system/bin/sh and now it is working.

The archive is updated, please redownload.

HoshDecember 6th, 2011 at 9:27 am

Anyone know of a MySQL server as well?

krzychDecember 15th, 2011 at 12:41 pm

@phpdeveloper – it’s not android bug, it’s just yours busybox bug (probably included with sshdroid – mine buggy version was from there). Try to download TitaniumBackup (it has busybox compiled by their dev’s and it’s working well with resolving, additionally it’s optimised). Remember to change PATH and symlinks if you want to use their busybox systemwide.

We need real sshd… Viulian? :D

viulianDecember 15th, 2011 at 3:08 pm

I wanted to mention that the libc used to build this PHP is uClibc – and not Android’s libc (the default one).
However, uClibc is actually following the standard and using /bin/sh for system(..) calls.

The trouble is the Google decided to use a specific /system/bin/sh instead of /bin/sh – so I had to change the source code of uClibc to hardcode /system/bin/sh instead of /bin/sh – to obtain an executable that works properly on Android.

haiyyuDecember 19th, 2011 at 4:53 pm

I hope you’re reading this.
I have tried installing PHP and lighttpd by following the instructions in your post.
Unfortunately I couldn’t extract the tar.gz archive using the tar command on my phone (BusyBox is installed) as it kept telling me the “magic number” of the archive was invalid.
So what I did is I extracted every single file to the specific folder (example: archive.tar/system/etc/lighttpd/lighttpd.conf to /system/etc/lighttpd/lighttpd.conf) after extracting the archive on my computer (it worked there). My problem is that I seem to be unable to copy “php-cgi” to the folder it’s supposed to be copied into (/system/xbin). I keep getting told copying the file failed.
I’m running Android 2.3.5 on a rooted Samsung Galaxy S2.

I would really appreciate it if you helped me as I would really like to run a webserver on my phone. :)

haiyyuDecember 19th, 2011 at 4:55 pm

What I forgot to mention in my last comment: Yes, I’m copying it as root. Every other file worked. I could even copy all the other files that were supposed to go into /system/xbin. Only “php-cgi” is refused to get copied.

adoet_tDecember 24th, 2011 at 8:58 pm

can’t extract tar file,,

tar xf /sdcard/php-5.3.8_lighttpd_1.4.29_armv5.tar.gz
tar: invalid tar magic

which version busybox you use?

sorry my poor english

PaulaDecember 30th, 2011 at 12:43 am


phpdevloperJanuary 4th, 2012 at 12:02 pm


You must make the /system partition r/w as it is readonly be default. This can be done by SuperManager file browser in the Options.

A better option is to put cgi-bin in the /data partition and symlink /system/xbin/php-cgi to the copy on the /data partition (You still need to r/w the system partition for one time). This keeps the system partition clean and it is already nearly full.

Salvatore BianchiFebruary 18th, 2012 at 8:27 am

When i try to copy a file in paw server directory from a web site URL fails, why?
This is error message:

Warning: copy(): php_network_getaddresses: gethostbyname failed. errno=111

There seems to be a problem with the name resolution.

viulianFebruary 20th, 2012 at 9:45 am

About gethostbyname failed. errno=111

I remember a similar issue when reading about OpenVPN. The static glibc that is bundled with OpenVPN needs to have access to /etc/resolv.conf, but Android doesn’t have it. You can manually add it.

I suspect a similar problem happens with this PHP too, please check /etc/resolv.conf or /etc/hosts to make sure they have valid data.

I will also check it out.

Little ZhaoFebruary 24th, 2012 at 2:32 am

There are some devices that the /system/xbin directory can’t be mounted r/w.So I tried to copy the php-cgi , lighttpd , fcgiserver to /system/bin. And it works!

viulianFebruary 24th, 2012 at 2:46 am

Thank you for feedback! Can you please tell an example of the said device ?
I expect them to work since the path is not hardcoded, and everything is statically linked, so they should run on any ARMv5 CPU from wherever you have the rights to execute them. Only the default configuration files might need change.
But is true, I could modify the installer to allow user to specify other install folder.

Little ZhaoFebruary 24th, 2012 at 3:07 am

It’s “HTC magic”,the second android phone of the world. “/system/xbin” is not a normal directory of “/system”,it’s another partition and it can’t be mounted r/w, leastways I cannot!
Another questions was that the php process have a high CPU load and all php pages will be halt, only the static pages work will.
My English is not well, I hope you can understand!

PinoyMarch 2nd, 2012 at 12:50 pm

Wow! this is so cool! I will try this on my android tablet later!

JorisMarch 22nd, 2012 at 3:48 pm

Hi, I’m using PAW for Android which is using your PHP as a plugin. I’m trying to use fopen() to open another website but I’m getting this error (Same problem as Salvatore Bianchi):

Warning: fopen(): php_network_getaddresses: gethostbyname failed. errno=111

You responded with:
“… please check /etc/hosts to make sure they have valid data.”
I did check the hosts file, and there is only one line: localhost
Is that what you call “valid data”?

I’m not using a rooted Tablet, could that be the problem?
Is there any other way to open or get the contents of another website (file_get_contents() gives the same error)?

viulianMarch 24th, 2012 at 12:07 am

@Joris, what about /etc/resolv.conf ?

I’ve wrote a small script to test:

        $time = file_get_contents('');

and it hanged for a while then died with:

failed to open stream: php_network_getaddresses: gethostbyname failed. errno=111

I’ve then created the /etc/resolv.conf and checked again:

[root@arc]/system/var/www# cat /etc/resolv.conf
[root@arc]/system/var/www# php time.php
X-Powered-By: PHP/5.3.8
Content-type: text/html

Original Time: 01:50:08
<br/>New Time: 01:50:08
JorisMarch 26th, 2012 at 12:26 pm

Hi viulian,
Thanks for your answer. I tried your solution, but as I said: I haven’t rooted my Samsung Galaxy tab 8.9, so I don’t have write acces in the directory /etc/. The App PAW Server that I’m using also has an ‘etc’ folder in ‘/mnt/sdcard/paw/etc/’ folder, so I put resolv.conf in that folder, but that didn’t help. I also tried creating an ‘etc’ folder in the webroot folder of PAW: ‘/mnt/sdcard/paw/html/etc/’. Didn’t work either.

I did solve the problem by opening a socket to the right IP address with fsockopen() and then create a HTTP request with the right headers. This worked for me. But the ‘file_get_contents’ function would be easier in use.
Does this mean it isn’t possible to solve this problem without a rooted device?

Thanks for your support.

viulianMarch 26th, 2012 at 12:44 pm

Good workaround :)

Well, I think the trouble with /etc/resolv.conf is that I guess it is hardcoded into ucLibc (as it follows glibc standard which assumes /etc/ exists).
I had a similar issue in the past, where the PHP exec() would call /bin/sh to invoke the script – and the trouble was not in PHP but in the glibc – again hardcoded value for /bin/sh – I had to recompile and have it hardcoded to /system/bin/sh ..

I would probably have to search glibc for /etc/resolv.conf (and /etc/hosts, /etc/nsswitch.conf) and made them configurable somehow – but I still need to figure out a way – since I can’t assume anything if the Android device is not rooted.

JorisMarch 27th, 2012 at 11:06 am

Thanks. Well, that explains it a bit. I hope you’ll come up with a solution. I’ll just check back on your website once in a while to see if there is a new version. For now, the socket solution works good enough.

And if you need a new build to be (béta) tested on a non-rooted device, I’m happy to help.

shxishApril 15th, 2012 at 2:18 pm

No armV7 architecture version

aksApril 25th, 2012 at 4:44 pm

when will be a curl library included…???

DeanApril 27th, 2012 at 3:47 am

Do you think php5.4 can be compiled for android? 5.4 has it’s own built-in webserver!
I’ve tried with buildroot but it seems to ignore php’s file…

viulianApril 27th, 2012 at 7:16 am

@Dean: I will give it a try in the weekend to see.

I will also investigate about curl issue to see what’s up with it.

viulianApril 29th, 2012 at 3:18 pm

I have successfully build 5.4.1 with curl and SSL option :)

It was nasty, I think I will put a “Donate” button on the page.

Anyway, here’s an update:

[root@arc]/system/var/www# php -v
PHP 5.4.1 (cgi-fcgi) (built: Apr 28 2012 03:52:49)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies

[root@arc]/system/var/www# php -m
[PHP Modules]

[Zend Modules]

shxishApril 29th, 2012 at 6:03 pm

$ su
could not kill pid -9: No such process
could not kill pid -9: No such process

How to solve this problem???(ARMv7 cpu ,android2.3.4)

viulianApril 29th, 2012 at 7:18 pm

I think those message only mean that the processes are not found (debug messages) and thus it had nothing to kill (probably the processes were not running).
If they are not running, then you have to check the logs to see why they failed to start.

DeanApril 30th, 2012 at 3:13 am

Hi, that’s great about 5.4! So are you going to open-source it or otherwise document how to get it done?
I tried a bit the other week but I’m still quite new to cross-compiling…
A donate button would be a great idea :)

phpdevloperMay 4th, 2012 at 11:45 am

Where can I download 5.4.1 ?

And is it affected by the PHP bug depicted here ?

viulianMay 5th, 2012 at 9:37 am

I did not release it yet since I got caught up in other ports … I’m working to see if I can get GCC running on Android itself and compiling things directly on the phone.

If 5.4.1 had the bug, then yes, but I will actually cross compile 5.4.2 then to not have the issue.

viulianMay 6th, 2012 at 10:17 am
[root@arc]/system/xbin# php-cgi -v
PHP 5.4.2 (cgi-fcgi) (built: May  6 2012 10:40:15)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies

About the source code, I did not modify anything … only that the build scripts that are heavily depended on my environment so not really reusable.

phpdevloperMay 7th, 2012 at 8:53 am

You meant did not change anything since 5,3,8 ?
But you have a workable binary ?

viulianMay 7th, 2012 at 1:32 pm

Sorry for the confusion :) probably they did change something and fix the bug and most probably the version 5.4.1 that I built had it.
I have thus updated to 5.4.2 so that the bug won’t be there anymore.

I will release it tonight – I made some tests with curl / exec and it works.

viulianMay 7th, 2012 at 11:45 pm

Please check the initial post, I have updated it with the download link for 5.4.2 as well as a small change log (curl / openssl now built in).

phpdeveloperMay 11th, 2012 at 6:15 pm

On Android 4 ICS it does not work anymore.

php /system/var/www/index.php

results in

Status: 404 Not Found
X-Powered-By: PHP/5.3.8
Content-type: text/html

No input file specified.

Is this a known problem ?

phpdeveloperMay 11th, 2012 at 7:02 pm

By the way I did NOT change any config files and used 5.3.8 + lighty 1.4.19.

viulianMay 11th, 2012 at 7:08 pm

Can you please tell me what kernel version you have ?

phpdeveloperMay 11th, 2012 at 8:43 pm

Kernel is 3.0.15-i9100-XWLP7-CL340913

It is pure in the php kernel, it is probably not a lighttpd issue.
I reproduce it also without lighttpd being loaded.
when I run :

cat var/www/phpinfo.php | php

it worrks fine (at least in a terminal.


php  var/www/phpinfo.php 

issues the ‘No input file specified’ error.
Strange. the 5.4.2 has the same issue. Seems that piping / redirecting is different in the 3.0 / ICS 4 kernel.

viulianMay 11th, 2012 at 10:06 pm

Ok, there are two things:

a) if you could find a strace that could help what goes on. I have one compiled for 2.6 kernels and it might work : (just unpack the .zip and copy the binary to /system/xbin)

Then issue:

strace -f php var/www/phpinfo.php > log.txt 2>&1

I’m curious if it is working, then if it produces results, what could be the problem. Please give me a link to the log file if you get one usable.

2) The trouble is that none of my phones have official ICS – I was able to put a ICS ROM on one of them (the S5570) but it comes with kernel 2.6.35 so … I suspect something in the kernel has changed – since really none of the other Android libs are used by the project.

I am waiting for S3 to appear then drop price and hopefully be rooted – I can’t afford now a phone with better kernel and ICS.

Tell me please if you are also using the official ROM of the phone – or some custom made cyanogenmod ROM ?

phpdeveloperMay 13th, 2012 at 8:40 am


Maybe it’s easier to communicate via email you should have my email address.
I tried it:

strace -f php var/www/phpinfo.php > log.txt 2>&1

did issue an error message that php does not exist.
So I tried:

localhost:systemfolder # strace -f xbin/php-cgi var/www/phpinfo.php 
strace: xbin/php-cgi: command not found
localhost:systemfolder # ls -al xbin/php-cgi                        
-rwxr--r--    1 root     root      10806533 Sep 22  2011 xbin/php-cgi
localhost:systemfolder # 

Strange that it issues ‘command not found’.
I have an official Samsung ROM (XWLP7) so no custom ROMs..

phpdeveloperMay 13th, 2012 at 9:59 am

Additional options:

php var/www/phpinfo.php

issues ‘No input specified’ but

cat  var/www/phpinfo.php | php

issues the expected output.
But in the fcgiserver script changing the script to

cat - | php -b -c /data/systemfolder/php.ini >> /data/systemfolder/var/log/fcgiserver.log 2>&1

does not work (same ‘no input file specified’ error). I googled around on the ‘no input file specified’ and there are lots of hits, but no tips for this.

phpdeveloperMay 13th, 2012 at 10:03 am

BTW if you have an S2 (or another Android phone for which ICS is officially released) you can just install ‘Mobile Odin Pro’ ($2), download an official ICS 4.0 kernel from Mobile Odin Pro flashes any kernel (also an official) on the device itself and roots it on the fly. I did this and after 4.0.3 was flashed, the root was retained.

phpdeveloperMay 13th, 2012 at 5:14 pm

You can also use an Android emulator which is part of the Android dev kit and emulate any official version on your Mac / Linux / Windows PC.

dqroidMay 18th, 2012 at 4:59 am

test on SAMSUNG Galaxy Nexus with Android 4.0.4 stock ROM

when I run :

cat var/www/phpinfo.php | php

it worrks fine (at least in a terminal.


php var/www/phpinfo.php

issues the ‘No input file specified’ error.

plz fix it

[…] Main Article: […]

ozan_the_galaxianJune 1st, 2012 at 2:01 am

Hey guys,
I had the problem with the ‘No input file specified’ too.
I use at the moment PHP 5.3.6, because the other versions cause problems..
Hopeful waiting for the fix..
(Using Galaxy Note with ICS 4.0.3 custom rom from alba)

viulianJune 1st, 2012 at 7:03 am

Please tell me what kernel you have on your Galaxy Note ?
I have a sort of fix for kernels 3.0 but is not perfect … I will have to buy a phone with ICS and Kernel 3.0 and do debugging (since on my ICS but with kernel 2.6 it doesn’t manifest).

ozan_the_galaxianJune 5th, 2012 at 12:39 am

Sure :) i dont know which rom was that, but i got the kernel insalled with the rom… currently i am using alba ddlp8.
Settings -> kernel version:
francisco@francisko #3

csharperJuly 4th, 2012 at 7:37 am

Btw viulian, couldn’t you use emulator rather than buy ICS phone? *just saying

MattJuly 4th, 2012 at 3:44 pm


I have the same problem, with Kernel 2.6

Tried all the suggestions from phpdev, and I get the same messages.

Any idea on how to solve this?

Linux localhost #2 PREEMPT Fri Sep 16 20:54:18 KST 2011 armv7l GNU/Linux

MattJuly 5th, 2012 at 2:44 pm

Same thing with:

Linux localhost #r14 PREEMPT Sun Mar 11 16:16:26 CLST 2012 armv7l GNU/Linux

Android 2.3.6

viulianJuly 10th, 2012 at 11:53 am

Sorry guys, I was out for a vacation and was not up to date. I will investigate the issues and hopefully fix them soon!

xilingJuly 24th, 2012 at 3:30 pm

Hi,could you compile it with gnu readline module,or the cli mode?I use it for script in terminal ,It ‘s very useful.thank you
I come from China,My English is not very.

zxtylerJuly 30th, 2012 at 4:03 am

hi,I installed php-5.4.2_lighttpd_1.4.29_armv5.tar.gz and SMF forum,but it says:

Critical Error!

The installer was unable to detect any database support in PHP. Please ask your host to ensure that PHP was compiled with the desired database, or that the proper extension is being loaded.
when I use other php+sqlite programes it alse has the same words:”Call to undefined function sqlite_open()”
I modified the php.ini and got rid of the “;” before the line about sqlite,but it didnt’ work.
It seemed php cgi does not support sqlite database, could u help me with that problem,thanks.

icJuly 31st, 2012 at 10:40 pm

Hi, I found some bug in “php-5.4.2_lighttpd_1.4.29_armv5.tar.gz”
It’s problem with ICONV
First example from php documentation ( )
works correcty on my localhost PHP 5.4.4, but on Android it failed with //TRANSLIT and //IGNORE flags. It write nothing.
It can be PHP bug: but I’m not sure.

Is there some chance to fix it? Please, ICONV is important for non-english countries.

phpdevloperAugust 3rd, 2012 at 9:54 am

zxtyler: This PHP does support sqlite. I have downloaded a PHP sqlite manager which works both on my Mac and Galaxy S2. Databases of apps can also be vewed or modified.

viulian: Did you already have a look at the dir() bug ?

HemantAugust 5th, 2012 at 4:55 pm

It seems like sqlite is not working with PHP 5.4.2. I tried with PHP sqlite manager as well.
It gives Fatal error: Call to undefined function sqlite_open()

viulianAugust 6th, 2012 at 6:32 am

Can you guys post a little snippet that I could use to test sqlite ?

Thank you,

HemantAugust 6th, 2012 at 6:57 pm

Here is the code for sqlite:-

$dbhandle = sqlite_open(‘test.db’, 0666, $error);
if (!$dbhandle) die ($error);
$stm = “CREATE TABLE Friends(Id integer PRIMARY KEY,” . “Name text UNIQUE NOT NULL, Sex text CHECK(Sex IN (‘M’, ‘F’)))”;
$ok = sqlite_exec($dbhandle, $stm, $error);

Roelf RenkemaAugust 15th, 2012 at 1:29 pm

Hmmm I am running cyanogen mod 9 and under 5.4.2 curl is giving me grief not being able to resolve hosts. Anyone can confirm?

Roelf RenkemaAugust 15th, 2012 at 1:54 pm

example code:



X-Powered-By: PHP/5.4.2
Content-type: text/html

array(26) {
string(21) “”
[“connect_time”]=> float(0)
array(0) {
string(0) “”
string(0) “”
array(0) {
string(0) “”
string(0) “”
string(0) “”
string(38) “Couldn’t resolve host ‘'”

Kernel with uname -a:

Linux localhost 3.0.8-g54d09f2 #1 PREEMPT Tue Aug 7 23:40:24 PDT 2012 armv7l GNU/Linux

Roelf RenkemaAugust 15th, 2012 at 2:39 pm

Last but not least, I just tried an ip address getting arround the resolve issue and that just went fine. I got the results I wanted. So it is defenitly something with resolving addresses.

[…] Share this:TwitterFacebookLike this:LikeBe the first to like this. This entry was posted in Minixandroid by invictaz. Bookmark the permalink. […]

aite.meSeptember 21st, 2012 at 4:12 am

I cross-compile php for android can not open the Internet domain name can help it?
error info:
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /mnt/sdcard/ROOT/var/www/special.php on line 2

Warning: file_get_contents( failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /mnt/sdcard/ROOT/var/www/special.php on line 2

phpdeveloperSeptember 30th, 2012 at 7:15 pm

This is not an issue of PHP but of your device.
Create a file in /etc called “resolv.conf”
with the addresses of DNS servers in it (here for example the DNS servers of Google):


How did you compile PHP ? Which tools did you use. I have a version in which the dir() and shell_exec() function do not work.

viulianSeptember 30th, 2012 at 7:24 pm

@phpdeveloper – what version are you using, as far as I remember dir() and shell_exec() were supposed to be fixed ?

aite.meOctober 1st, 2012 at 4:30 am

This is my cross-compile php5.4.7(
The network dns and shell_exec () not working properly!
I produced php for android integration, which includes lighttpd, php, mysql.

aite.meOctober 1st, 2012 at 4:36 am

I arm debian linux gcc compiler in qumu virtual machine used.

phpdeveloperOctober 3rd, 2012 at 9:55 pm

I tried the versions 5.4.2 of 17 May and 5.4.7 from download link above.

5.4.2 as earlier mentioned, dir() and shell_exec() do not work
5.4.7 as earlier mentioned, dir() works flawlessly but and shell_exec() not and now file_get_contents() does not work. It issues the following warning:

Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /mnt/sdcard/website/startpage/google.php on line 44

Warning: file_get_contents( failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /mnt/sdcard/website/startpage/google.php on line 44

Reloading the same page with 5.4.2 works fine.

aite.meOctober 5th, 2012 at 8:23 am

I compiled php can open ip, but can not open the domain name.

aite.meOctober 5th, 2012 at 8:31 am

Can compile lighttpd latest version?
Specify the temporary directory :/data/local/tmp。
You compile lighttpd due to the cache directory can not accept large file uploads。

phpdevloperOctober 5th, 2012 at 10:09 am
> I compiled php can open ip, but can not open the domain name.
When file_get_contents() does open an IP address but not a domain name then there is a problem in resolving domains.
Did you try it from the prompt ? If yes, try e.g. ping .
And did you try a website

$content = file_get_contents("");
echo "<pre>".htmlentities($content); "</pre>";

And run the website from the browser localhost/path/yourfile.php .

viulianOctober 5th, 2012 at 10:27 am

Ok guys, I’ll have a look in the weekend. I’m sorry for the inconvenience. I might also ask for some sample code just to make sure I execute the same thing.


phpdevloperOctober 5th, 2012 at 2:19 pm , @viulian:

Having a look at this function might help ? Gethostbyname() is IMHO the workhorse behind domain based hostnames in file_get_contents() with a URL.

aite.meOctober 5th, 2012 at 2:56 pm

I compiled php based on glibc library, android is based Bionic library. Need to refer to the the Bionic library can solve dns problem.

phpdeveloperOctober 5th, 2012 at 6:59 pm So you got it working ?

SebZOctober 5th, 2012 at 11:16 pm

Hi guys Thank you very much for all the feedback!! It s working for me on asus tablet tf101. It has some bugs but curl and file_get_contents is working fine. I only have to retart en TAR FX everytime to get it working after every restart! Is there no services install, or something quicker to start it more quicker?

Again Thank you very much for all the hardwork!

aite.meOctober 6th, 2012 at 3:59 am

No, just do dns problem.

aite.meOctober 12th, 2012 at 8:13 am

Do you use the cross compiler tools? Where to download?

phpdeveloperNovember 18th, 2012 at 10:47 am

Some (strange) good news: Using the Viulian version of PHP 5.4.2 and setting the document root of lighttpd in the /sdcard tree results in that the dir() function *does* work.

server.document-root = "/data/systemfolder/var/www"
# dir() not working

server.document-root = "/sdcard/www"
# dir working

I always use the first version. So it seems that the dir() function cannot handle ext4 file systems (native to Android 4.x) and no FAT systems when the document root is symlinked as it was in my case.
Now I changed my document root and the dir() is working ! But still an issue on ext4.

viulianNovember 18th, 2012 at 11:49 am

Wow, interesting! I’m happy it works for you with the /sdcard since I’m at a loss why it wouldn’t work with the /system partition.

Can you please tell me your mount options for /system – since mine is ext4 and dir() works also ?
After checking your post more carefully – I never tried having the root folder into /data folder, I always used /system/var/www – I will check now with the /data too – as I see in your post above.
For sure, the /data has more mount options than /system – maybe something here causes the problem. Here’s mine:

/dev/block/mmcblk0p9 /system ext4 rw,relatime,barrier=1,data=ordered 0 0
/dev/block/mmcblk0p12 /data ext4 rw,nosuid,nodev,noatime,barrier=1,journal_async_commit, data=ordered,noauto_da_alloc,discard 0 0

Thank you very much again for spotting this!

Later edit: I am still not able to reproduce the problem with the dir() having /data/…/ as the root. Maybe the mount options are different from you ?
What is the locale of your phone ? Maybe something else is different, since I remember you had the same issue in the past with a different phone.

phpdevloperNovember 19th, 2012 at 9:54 am

I replied you via pm on xda.

secaviarJanuary 5th, 2013 at 7:28 pm

Problem with php.ini :
– in /system/xbin/fcgiserver, if I use “-c /system/etc/php/php.ini” option in php call, phpinfo says :
. Configuraton file path : /system/etc/php
. Loaded configuration file : (none)
– if I write “-c /system/etc/php/”, phpinfo says :
. Configuration file path ! /system/etc/php
. Loaded configuration file : /system/etc/php/php.ini

In either case, configuration options in php.ini are totally ignored.

Any Idea ?

viulianJanuary 5th, 2013 at 7:57 pm

Can you please provide a configuration parameter that you’ve modified and which gets ignored ?

secaviarJanuary 8th, 2013 at 1:01 am

The parameter I wish to modify is session.save_path since my apps use sessions to save variables and, with the default value, an error is fired every time I call session_start in PHP.

Since I cant update this parameter, I have to code a session_save_path call in every php page of my apps.

viulianJanuary 10th, 2013 at 12:18 am

I’ve tested and it works for me …
I have my session.save_path set to /data/local/tmp and session_start works.

The moment I change the session.save_path to an wrong folder (such as /fff ) – I get

Warning: session_start(): open(/fff/sess_2b03akgq6f8v5ds2r960v6slt0, O_RDWR) failed: No such file or directory (2) in /system/var/www/session.php on line 4

To me it seems that something is wrong on your configuration, but I can’t tell what from the description..

Can you please try to move the ini file to another partition ? Such as /data/data/etc for example and try again ? There are reports that sometimes php fails to read certain partitions (I don’t understand yet why, I never had a phone like that to investigate more …)
A solution would be to move the configuration file to /data/data/etc/php/php.ini for example ?

secaviarJanuary 10th, 2013 at 10:15 am

As you suggested, everything is OK if I move php.ini to another directory (I use /sdcard/data/phpconf on my Galaxy Tab 2).

Thank you for your help.

anilsonejiJanuary 12th, 2013 at 2:09 pm

mysql functions is not work

MaroJanuary 23rd, 2013 at 8:27 pm

How to make mysql works?

DenisKJanuary 24th, 2013 at 9:16 pm

Hello! Please, viulian, can you tell what exactly I need to change in glibc
for exec() and system() (passthru()) to properly function? I think I must
change somewhere “/bin/sh” to “/system/bin/sh”. Then crosscompile glibc
and use it to crosscompile PHP. Also I want to know how to tell PHP
to use my recompiled glibc during crosscompile. I will very appreciate your help.

MietekNJanuary 26th, 2013 at 4:25 pm

Unfortunately, in both editions of php does not work start with proc_open() . Always returns an error number 127 (file not found). Running the same command with the exec() works fine.

DenisKFebruary 6th, 2013 at 3:14 pm

Hello! Does someone crosscompile PHP with Android bionic instead glibc? I want to fix the problem with DNS (gethostbyname()).

viulianFebruary 6th, 2013 at 3:30 pm

DenisK, using bionic, I think there was another PHP project compiled which was meant to be used as a scripting language as far as I remember.

For the /system/bin/sh, I need to search the code, but if I remember well, by default it uses a PATH environment variable which contains the /bin/sh as first (and only) entry. This has to be modified to include /system/bin/sh.
For how to tell PHP to use your glibc it is part of the cross compiling options provided with PHP.

DenisKFebruary 6th, 2013 at 4:05 pm

I already solved “/system/bin/sh” problem by editing some files in glibc source and then crosscompiled PHP with it. But gethostbyname() still does not function. I try to create /etc/resolv.conf and /system/etc/resolv.conf on my Adnroid device with DNS ip addresses but nothing happens. The main question is how to make gethostbyname work? I will very appreciate your help. So I think that bionic is needed. Above you wrote that creating /etc/resolv.conf will fix gethostbyname(). Why does it not work in my case? I crosscompile PHP using CodeSourcery toolchain (arm-none-linux-gnueabi). PHP 5.4.11.

yerminFebruary 8th, 2013 at 3:16 am

I install this on S3C2416 demo board, But can not run correctly. I got “500 – Internal Server Error” or “503 – Service Not Available”.
It simes seems lighttpd is OK, but php do not work.

[root@spc2416 /]# /system/bin/lighttpd
2000-01-01 10:44:35: (src/server.c.595) No configuration available. Try using -f option.
[root@spc2416 /]# /system/bin/php
Illegal instruction
[root@spc2416 /]#

viulianFebruary 8th, 2013 at 9:27 am

It could be because I have compiled it with ARMv7 architecture I think .. I will read more about your board.

Love PHPFebruary 19th, 2013 at 6:35 am

Can you help me to create tutorial step by step compile lighttpd for android which binary is ARM and static linked. I have compile with scons there if I check with file build/lighttpd-static not ARM but Intel. Or please sent to me file Sconstruct. I compile with arm-none-linux-gnueabi

Love PHPFebruary 19th, 2013 at 10:43 am

I have success compile lighttpd, but server.dirlisting= “enable” not working. So always return 404 and index file not working so.
How to fix it? thanks.

phpdevloperFebruary 28th, 2013 at 9:46 am

I finally found an even better PHP binary by installing the KSWEB app.
This PHP handles the dir() function correctly in all Android paths. Moreover it supports mysql as well.
Maybe you can contact the developer about cooperation, etc ?

viulianFebruary 28th, 2013 at 10:29 am

@phpdeveloper – I will do my own build and put everything on the market – yesterday I was able to reproduce the problem with accessing dirs by playing with the cifs module and Midnight Commander. It seems that once my Windows share is mounted, I can’t access the folder using MC (it is the same behavior for PHP, only that for some people it also happens for other folders, like /data and /system or /sdcard).
It seems to be a bug in the opendir function that doesn’t call the 64 bit stat method, but the old 32 bit one.

I will fix it as soon as possible ..

dh JMarch 13th, 2013 at 10:40 am

Thanks great post. possibly, Is there a way? install(or run) without mounting /system partition as RW.

MietekNMarch 14th, 2013 at 8:11 pm

@dh J –

RickMarch 18th, 2013 at 12:58 am

Hi there, I got this message in my device,
I have run it as a root :

sh: ./lihgttpd-static: cannot execute – Permission denied

Any ideas ?

Love PHPMarch 18th, 2013 at 8:09 pm

Hi All. I’m using arm-none-linux-gnueabi from code sourcery to compile php and success get a binary file in sapi/cgi/php-cgi
But if I running script php to exec(), system(), pasthru() not working.
What should I do to work?
I saw above should be changed /bin/sh to /system/bin/sh, but I do not know where/which file should I change?
I hope my friends here can help solve my problem.

Love PHPMarch 18th, 2013 at 8:55 pm

Do you have try compile it with code sourcery which cross compiler is arm-none-linux-gnueabi-
I compile php-cgi with it, but function gethostbyname(), file_getcontent(), and etc which need call to internet not work, I have put file resolv.conf to /system/etc/ and /etc/ but still not work.
Can you tell me how to fix it step by step.
I have download and try your binary, it success and no problem, but my binary not work.
Please tell me step by step.

Love PHPMarch 19th, 2013 at 7:59 pm

Hi all I have resolved function system, exec, pasthru with compile glibc new, but before compile glibc new I search on all file with grep /bin/sh intead #!/bin/sh and change to /system/bin/sh.
So now my problem just gethostbyname, gethostbyaddr, etc.

Thanks for advance.

viulianMarch 19th, 2013 at 8:34 pm

Congrats for the /bin/sh fix :) as far as I remember, the trouble is with the built in PATH variable which points to /bin instead of /system/bin .. but if it works, is perfect.

About get host by name, I think there’s nothing to fix, it should work by default – I did not touch anything related to that …
What glibc are you using ? I’ve used buildroot 09/11 ..

Love PHPMarch 21st, 2013 at 7:48 am

@Vulian: Ohhh I see. May I request file .config.log.old for your buildroot, Because I want to use your configuration buildroot.

Thanks vulian.

Love PHPMarch 21st, 2013 at 3:07 pm

@Vulian: I have success make menuconfig for configure buildroot, I choose target arm-litleendian and target variant is generic_arm And in Filesystem Image I just select Tar. And after that I run make, I has been wait about 4/5 hours, So after I make, How I must to do for get PHP.

Love PHPMarch 22nd, 2013 at 5:58 am

@Vulian: I have success compile php, but it not static, and how to I change solved to path /bin/sh in order to solved function exec, shell_exec, etc.


viulianMarch 22nd, 2013 at 8:20 am

@Love PHP

Congrats! Please check the ucLibc source code for the method exec – and you will see there is a PATH variable which is checked to find the “sh” executable, and the path only contains /bin folder. You will need to add there /system/bin also.

About static, you don’t need to change anything, just check in the configure of PHP how to build it static …

Love PHPMarch 22nd, 2013 at 11:36 am

Hi vulian, I has been solved with exec, but If I use function file_getcontent, etc which call to internet it’s very long time, about 10-15 second, My connection very stable, Can you help me once again :)


Love PHPMarch 24th, 2013 at 8:49 pm

Finally, I cannot success compile, I get error segment fault :(

Linux on Cliq2March 25th, 2013 at 12:14 am

[…] […]

MietekNMarch 25th, 2013 at 1:17 pm

@Vulian: May I request file .config from Your buildroot (probably buildroot-2011.05)?

viulianMarch 26th, 2013 at 7:31 pm

Here’s the a tar.gz containing the .config file for buildroot:

MietekNMarch 29th, 2013 at 11:04 am

Thank You very much. I compiled php-5.4.2 for arm-generic and found the error. In order to function properly proc_open function You should also improve the proc_open.c twice “/bin/sh” to “/system/bin/sh”.

MietekNMarch 29th, 2013 at 2:56 pm

Here is my php-cgi for tests:

MietekNMarch 30th, 2013 at 6:37 pm

Here are my manula, configuration and patches:

MietekNApril 1st, 2013 at 6:33 pm

Both files are now available on the server 4shared”

Love PHPApril 16th, 2013 at 10:29 am

Hi @Vulian.

I’ve given up with compile php :( . it’s very difficult, now I want to ask how the details to compile lighttpd for android.

Thank you.

MietekNApril 27th, 2013 at 11:14 am

@Love_PHP here is php compile instruction:

21@sd95April 30th, 2013 at 8:08 am

Thank you so much for this :)
Altought I have one question, I can’t use imagettfbbox() which requies gd plugin, it seems that gd plugin works, exept this one command? any ideas?
or is there any other way to implement gd? like in linux with module?
thankyou for answers and feedback

aite.meMay 11th, 2013 at 3:55 pm
Android Nginx MySQL PHP-FPM PostgreSQL

MietekNJune 1st, 2013 at 5:48 pm

PHP Plug-in for the PAW server containing my compilation of PHP 5.4.2 compiled for ARM processors and also for x86 processors (PHP-5.4.2_arm, PHP-5.4.2_i386):

yerminJuly 20th, 2013 at 2:33 am

hi, all
I got a “500 – Internal Server Error” after about 400-600 requests, and the “/system/bin/php” process is lighttpd log:

2013-07-20 00:21:23: (src/log.c.166) server started
2013-07-20 00:23:38: (src/mod_fastcgi.c.2566) unexpected end-of-file (perhaps the fastcgi process died): pid: 0 socket: tcp:
2013-07-20 00:23:38: (src/mod_fastcgi.c.3354) response not received, request sent: 1036 on socket: tcp: for /index.php?, closing connection
2013-07-20 00:23:38: (src/mod_fastcgi.c.2566) unexpected end-of-file (perhaps the fastcgi process died): pid: 0 socket: tcp:
2013-07-20 00:23:38: (src/mod_fastcgi.c.3354) response not received, request sent: 1036 on socket: tcp: for /index.php?, closing connection
2013-07-20 00:23:38: (src/mod_fastcgi.c.2566) unexpected end-of-file (perhaps the fastcgi process died): pid: 0 socket: tcp:
2013-07-20 00:23:38: (src/mod_fastcgi.c.3354) response not received, request sent: 1036 on socket: tcp: for /index.php?, closing connection
2013-07-20 00:23:38: (src/mod_fastcgi.c.2566) unexpected end-of-file (perhaps the fastcgi process died): pid: 0 socket: tcp:
2013-07-20 00:23:38: (src/mod_fastcgi.c.3354) response not received, request sent: 1036 on socket: tcp: for /index.php?, closing connection
2013-07-20 00:23:38: (src/mod_fastcgi.c.2904) establishing connection failed: Connection refused socket: tcp:
2013-07-20 00:23:38: (src/mod_fastcgi.c.2910) backend is overloaded; we’ll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 1
2013-07-20 00:23:38: (src/mod_fastcgi.c.3595) all handlers for /index.php? on .php are down.
2013-07-20 00:23:40: (src/mod_fastcgi.c.2852) fcgi-server re-enabled: tcp:

my php file:
$_SESSION['views'] = $_SESSION['views']+1;
$_SESSION['views'] = 1;
echo $_SESSION['views'];
echo '';
echo ‘hello world, now is ‘;
echo date(“Y-m-d H:i:s”);
echo ”;
echo ‘current path is ‘;
echo ”;
echo ‘proc:';
echo “”;
echo system(‘top -n 1′);
echo ”;
echo ‘dir /:';
echo “”;
echo system(‘ls /’);
echo ”;

cloudJuly 20th, 2013 at 3:43 am

I setted /etc/resolv.conf to 0755 permission and file_get_contents worked… I’m running paw server…
The contents of resolv.conf is:

dinakaranAugust 6th, 2013 at 5:13 pm

OS:centos I need to cross compile lighttpd server for ARM platform using scratchbox, While compiling, it shows the following packages were not installed, pcre,zlib,bzip2 but I have already those packages in my system. then i use –without-pcre,zlib,bzip2, but while deploying in android it shows is missing. any solution?

viulianAugust 9th, 2013 at 11:06 pm

Have you tried to statically build everything ?

Love PHPSeptember 3rd, 2013 at 6:10 pm

How to compile lighttpd to be static for android?
I looking for at google, untill now not success.

viulianSeptember 3rd, 2013 at 8:08 pm


What is the error that you get for lighttpd ? The process is rather tedious since they use scons to compile as far as I remember, and you have to spend a while to read about it.

Love PHPSeptember 6th, 2013 at 11:27 am

Hello @viulian.

Please give me your config file “SConstruct” at root lighttpdsource and file “SConscript” at src folder lighttpdsource.

Thank you

macaakOctober 16th, 2013 at 4:59 pm

The php application is unable find fnmatch function? How could I fix it?

o dDecember 17th, 2013 at 12:23 pm

ive been looking for an alternative to programming in android,

I know php very well..

ive been thinking why there is not a packaging system

that combines

php executable
a minimal (or none) httpd server
a browser for local browsing, embedded in a main program in java
and php scripts

to make a apk program

that could be put in play market, downloaded, installed and run locally?

the java shell would have a browser window,
it would run the php script with the php executable,
show the results directly in the browser window, html returned from the php
any clicks or input would be collected and sent to the php script again,
and the html result shown again in the browser,

no need for learning interface commands or java or other languages,
all you would need is php and html and you can write full programs

even graphical things with gd library..

christianDecember 17th, 2013 at 9:30 pm


your work is almost exactly what i’ve been looking for!

I want to run a webserver on my android phone to serve files to my ipad (storage is expensive there). I tried some webserers from the android marked, but the don’t do the job for video files.

Lighttpd on linux does the job, so i guess Lighttpd on Android will do as well – unfortunatey my phone has a ARMv7 CPU and reading the posts there seem to be issues with that. Any plans to further investigate the ARMv7 thing? Could you post the options uses to build for ARMv5?



MietekNDecember 25th, 2013 at 9:50 am

PHP and Lighttpd for Android compiled for ARMv5 also works on ARMv7 architecture.

JophJune 24th, 2014 at 9:30 am

I run your webserver on my android device,but it doesn’t walk well.
my device don’t have command ‘tar xf’ , busybox either

so I uncompression your package and push then to my device
and I run command:
root@android:/system/xbin # /system/xbin/fcgiserver &
[1] 3287
root@android:/system/xbin # /system/xbin/lighttpd-static -f /system/etc/lighttpd/lighttpd.conf
[1] + Done (255) /system/xbin/fcgiserver
[ 141.429666] init: untracked pid 3299 exited
root@android:/system/xbin #

then I visit
it shows 500 – Internal Server Error

StephenJuly 15th, 2014 at 5:55 am

How can APC be enabled?

JonJuly 30th, 2014 at 7:43 am

PHP 5.4+ now contains a built-in web server. Any chance you will compile a CLI version of PHP (ideally 5.5) without lighttpd? I think this would be incredibly useful! Thank you for your work on this.

viulianJuly 31st, 2014 at 1:55 pm

I’ll give it a try :) thank you for the suggestion.

huckleberryJanuary 19th, 2015 at 7:04 am

Thanks for your wonderful work! I see a little typo in the instructions:

There should be underscores here instead of hyphens.

Leave a comment

Your comment