Is there a difference between compiling php with the parameter:
--with-[extension name]
as opposed to just compiling it as a shared module and including it that way? Is there any performance benefit? If not, why would you want to do this?
Maybe it won't be a full answer to your question, but here's what I've been able to find so far : there is some kind of a partial answer in the book "Extending and Embedding PHP", written by Sara Golemon (amazon ; some parts are also available on google books).
The relevant part (a note at the top of page 56) is :
Ever wonder why some extensions are configured using
--enable-extname
and some are configured using--with-extename
? Functionnaly, there is no difference between the two. In practice, however,--enable
is meant for features that can be turned on witout requiring any third-party libraries.--with
, by contrast, is meant for features that do have such prerequisites.
So, not a single word about performance (I guess, if there is a difference, it is only a matter of "loading one more file" vs "loading one bigger file") ; but there is a technical reason behind this possibility.
I guess this is done so PHP itself doesn't require an additionnal external library because of some extension ; using the right option allows for users to enable or disable the extension themselves, depending on whether or not they already have that external library.
Maybe a difference in the memory footprint ?
Correct me if I am wrong but a built-in module will be duplicated in every process loaded in memory (because it's statically linked) whereas a shared module will be loaded only once and shared by all php process.
I have noticed when having all functions loaded as shared modules php pages load faster and cpu usage is lower, however some command line php functions dont work properly. Its logical to assume that a shared module setup is more ram efficent than a large static binary, as the modules would only be loaded when required.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With