compiling to get the smallest interpreter binary possible

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
startx
Forum Newbie
Posts: 9
Joined: Mon Jul 16, 2007 2:34 am

compiling to get the smallest interpreter binary possible

Post 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.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Re: compiling to get the smallest interpreter binary possibl

Post 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());
startx
Forum Newbie
Posts: 9
Joined: Mon Jul 16, 2007 2:34 am

Post 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 ;)
Post Reply