# PHP footprint and sharing code among SAPI binaries

- Thread: https://externals.io/message/35809
- Original archive: https://news-web.php.net/php.internals/35809
- Started by Eugene San on 2008-02-26T20:48:38+00:00
- Messages: 8
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #35809 — Eugene San — 2008-02-26T20:48:38+00:00

URL: https://externals.io/message/35809#35809

Hi all,


I want to raise a discussion on subject that is very important for PHP 
usage on Embedded platforms.

I am myself working on projects where we use PHP to manage embedded 
devices. Everything was fine but lately the need to work from flash 
memory appeared.

We discovered that PHP binaries are linked statically with whole PHP 
functionality and there is huge overhead when several SAPI modules used 
on same system.


I have few question I hope to get answers on or ideas for:


1) Is there any reason to link all PHP SAPI modules statically with all 
PHP objects?

2) Is it possible to extract all shared functionality to shared object 
and links all SAPI modules against it?

3) Next issue is XML with DOM support, we where using LIBXML2 but that 
costs ~2.5MB are there there options for supporting that?


Maybe someone already addressed footprint problem and has any kind of 
solutions for that?

Please, any kind of information will helpful here.


Thanks ahead.

Eugene San

---

## #35810 — Daniel Brown — 2008-02-26T21:06:17+00:00

URL: https://externals.io/message/35809#35810 · In reply to: #35809

> Hi all,
>
>
>  I want to raise a discussion on subject that is very important for PHP
>  usage on Embedded platforms.
>
>  I am myself working on projects where we use PHP to manage embedded
>  devices. Everything was fine but lately the need to work from flash
>  memory appeared.
[snip!]
>
>  Maybe someone already addressed footprint problem and has any kind of
>  solutions for that?
>
>  Please, any kind of information will helpful here.

    Eugene,

    Not sure if this will help you, but this is something I came
across last night while working on a way to create a 100% mobile
server and website on my Windows Mobile Treo (purely for geek
purposes).  I haven't had the chance to play with it, but if nothing
else, it may give you some ideas.

    Pocket HPH:
        http://mobileleap.net/hph/

-- 
</Dan>

Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?

---

## #35813 — Antony Dovgal — 2008-02-27T08:48:00+00:00

URL: https://externals.io/message/35809#35813 · In reply to: #35809

> 1) Is there any reason to link all PHP SAPI modules statically with all 
> PHP objects?

In most cases you need only one SAPI, so there is no reason to share something.

> 2) Is it possible to extract all shared functionality to shared object 
> and links all SAPI modules against it?

That's how it works on Win32. 
And I have to mention that I've seen LOTS of bug reports from people who forget 
to update php(4|5)ts.dll when upgrading PHP.

> 3) Next issue is XML with DOM support, we where using LIBXML2 but that 
> costs ~2.5MB are there there options for supporting that?

What costs 2.5MB?
Dynamic linking against libxml2.so?
 
-- 
Wbr, 
Antony Dovgal

---

## #35829 — Eugene San — 2008-02-27T18:04:44+00:00

URL: https://externals.io/message/35809#35829 · In reply to: #35813

Antony Dovgal wrote:

> 
>   
> > […]
>
> In most cases you need only one SAPI, so there is no reason to share something.
>
>   
> > […]
>
> That's how it works on Win32. 
> And I have to mention that I've seen LOTS of bug reports from people who forget 
> to update php(4|5)ts.dll when upgrading PHP.
>
>   
> > […]
>
> What costs 2.5MB?
> Dynamic linking against libxml2.so?
>   
Linking against libxml2 costs 0.4MB and libxml2 itself 2.1MB.

---

## #35830 — Antony Dovgal — 2008-02-27T18:06:37+00:00

URL: https://externals.io/message/35809#35830 · In reply to: #35829

> > […]
> Linking against libxml2 costs 0.4MB and libxml2 itself 2.1MB.

Ok, so what are you proposing?

-- 
Wbr, 
Antony Dovgal

---

## #35831 — Eugene San — 2008-02-27T18:15:24+00:00

URL: https://externals.io/message/35809#35831 · In reply to: #35830

Antony Dovgal wrote:

> 
>   
> > […]
>
> Ok, so what are you proposing?
>   
I was thinking of extracting shared objects among SAPI modules to 
separate module and link against it.

---

## #35836 — Andi Gutmans — 2008-02-28T01:54:18+00:00

URL: https://externals.io/message/35809#35836 · In reply to: #35809

Hi Eugene,

Do you want to have an option to exclude libxml2 and its related functionality from the build? If so, have you done the analysis of what pieces of PHP create this dependency?

In general, for the typical Web developer the tight integration of XML is a positive thing but if it's a minor tweak we may be able to look at that. You'd have to be more precise with this list though on what you really need and if you've managed to figure out the dependencies which prevent you from achieving your goals.

Andi

> -----Original Message-----
> From: Eugene San [mailto:eugenesan@gmail.com]
> Sent: Tuesday, February 26, 2008 12:49 PM
> To: PHP Developers Mailing List
> Subject: [PHP-DEV] PHP footprint and sharing code among SAPI binaries
> 
> Hi all,
> 
> 
> I want to raise a discussion on subject that is very important for PHP
> usage on Embedded platforms.
> 
> I am myself working on projects where we use PHP to manage embedded
> devices. Everything was fine but lately the need to work from flash
> memory appeared.
> 
> We discovered that PHP binaries are linked statically with whole PHP
> functionality and there is huge overhead when several SAPI modules used
> on same system.
> 
> 
> I have few question I hope to get answers on or ideas for:
> 
> 
> 1) Is there any reason to link all PHP SAPI modules statically with all
> PHP objects?
> 
> 2) Is it possible to extract all shared functionality to shared object
> and links all SAPI modules against it?
> 
> 3) Next issue is XML with DOM support, we where using LIBXML2 but that
> costs ~2.5MB are there there options for supporting that?
> 
> 
> Maybe someone already addressed footprint problem and has any kind of
> solutions for that?
> 
> Please, any kind of information will helpful here.
> 
> 
> Thanks ahead.
> 
> Eugene San

---

## #35845 — Eugene San — 2008-02-28T12:05:07+00:00

URL: https://externals.io/message/35809#35845 · In reply to: #35836

Andi Gutmans wrote:
> Hi Eugene,
>
> Do you want to have an option to exclude libxml2 and its related functionality from the build? If so, have you done the analysis of what pieces of PHP create this dependency?
>   
Currently I've replaced libxml2 with libexpat + DOM in php, that solution saved 400K in PHP.
I am pretty sure performance of DOM won't be same but that suits my needs.
I've experienced problems with finding correct parameters for configure, and finished with passing --disable-all and --enable-xxx for every feature i needed.


> In general, for the typical Web developer the tight integration of XML is a positive thing but if it's a minor tweak we may be able to look at that. You'd have to be more precise with this list though on what you really need and if you've managed to figure out the dependencies which prevent you from achieving your goals.
>
> Andi
>
>   
> > […]
