Page 1 of 1

compiling to get the smallest interpreter binary possible

Posted: Fri Jul 20, 2007 5:26 pm
by startx
i try to optimize php for usage on embedded systems like mips (router etc ). as i know quite
well what functions i need, i want to try to compile an interpreter binary which is as small as possible.

after only using some really necessary extensions, the interpreter size is now down at about 2.3Mb
but there are still lots of functions i will never need. is there a strategy to (step by step) exclude even
funtions which belong to the standard of php (not only pecl extensions). i would like to remove funtionality even from the core whereever possible.

if i look at the php documentation ( http://www.php.net/manual/en/funcref.php ) nothing really tells me
whats extension and what belongs to the core without browsinf through every page of the documentation.

i think i hardly need 30% of php's functionality. so whats a strategy to - lets say - get a binary of a size
of maybe 1.5Mb ? i googled if other people did that but couldnt find much help.

Re: compiling to get the smallest interpreter binary possibl

Posted: Sat Jul 21, 2007 3:52 am
by volka
startx wrote:if i look at the php documentation ( http://www.php.net/manual/en/funcref.php ) nothing really tells me
whats extension and what belongs to the core without browsinf through every page of the documentation.
You can try

Code: Select all

print_r(get_defined_functions());

Posted: Tue Jul 24, 2007 5:49 am
by startx
hm, maybe im just totally worng if i find the compiling options and possible tweaks
not very well documented in php. i dont speak of "configure --help", but of more
sophisticated adjustments.

it seems nobody really ever worked on building interpreters for specific purposes,
environments where the used functions are known beforehand and the php interpreter
could actually be reduced to minimal functionality.

ive seen a thttpd-php bundle once which was very small, unfortunately the source code
seems not to be around anymore, at least not with php5.

so any hints on where to go from here is appreciated ;)