473,749 Members | 2,402 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Which is better: Static or dynamic extensions?

I like the idea of compiling DSO modules for Apache. It allows me to turn
on or off things we may or may not need at a given time (like mod_ssl,
mod_auth_mysql, mod_auth_ldap, etc.) and also allows me to compile in new
versions of modules without having to rebuild Apache from scratch.

Now, when I build PHP, I tend to put in a lot of things. Like:

../configure --with-mysql=/usr --with-openssl --with-pdflib=/usr/local --with
-bz2 --with-mhash --with-mcrypt ...

etc. etc. All of these modules are things that we use, but some of them not
very frequently.

So I'm trying to learn more about PHP's dynamic extensions. I didn't even
know that they existed, until I looked at the php.ini and phpinfo() output
of the PHP version that comes with RedHat 9.0. I see that instead of doing
things like:

./configure --with-mysql=/usr

they do

./configure --with-mysql=shared,/usr

So I guess my questions are:

1) Where can I learn more about PHP dynamic extensions? Maybe I'm looking
in the wrong places, but the documentation on them seems to be quite light.

2) Can *any* module be compiled as a dynamic extension, just by putting
"shared" in the appropriate place in the ./configure command? Or just a
few? How can you figure out which ones can, and which ones can't?

3) What are the advantages and disadvantages to making dynamic extensions?
I'm guessing that advantage=small er core PHP and disadvantage=sl ower initial
load time. Is that right? Anything else?

4) Similar to #3, is building dynamic extensions whenever possible
considered a Good Thing? Or are most people just still building everything
into a single monolithic libphp4.so ?

Thanks!
Jul 17 '05 #1
1 8219
That is quite interesting. I did not know that not only apache, but also
PHP allows you to use shared libraries.

I have heard many times that PHP is faster when it is compiled statically
into the httpd.
I have always done it that way, I actually always compiled _all_ apache
modules statically (maybe I am a speed freak?). However, it has a big
disadvantage: If you want to upgrade PHP, you have to recompile PHP and
apache with all modules again. That can be a bit tedious at times.
With my next server I will rather build PHP and others as a shared
modules, it leaves more flexibility when wanting to change things later.

As for shared PHP modules, I suggest you do this in your PHP source
directory:
../configure --help > configure-help
Then open the configure-help file and read through it. It specifically
states there:
NOTE: Not all extensions can be build as 'shared'.
Unfortunately it does not tell you much more, there are a couple comments
in the config help though that tell you something like "this can be a
shared module" etc. I suppose those are the only ones you can build as
shared modules, but I am not sure.

But then again, I think PHP is really very fast already, so do you really
need to have shared modules for PHP as well? I don't know. I have read a
few threads that were comparing PHP to other scripting languages, stating
that PHP comes with too many functions. That's very wrong though. You may
find over 2000 functions in the manual, but most people will never build
PHP with support for all those functions. My typical installation includes
only a bit more than 700 functions, and I have never found PHP to be too
slow.

DrTebi
On Thu, 11 Dec 2003 11:31:58 -0500, George Adams wrote:
I like the idea of compiling DSO modules for Apache. It allows me to turn
on or off things we may or may not need at a given time (like mod_ssl,
mod_auth_mysql, mod_auth_ldap, etc.) and also allows me to compile in new
versions of modules without having to rebuild Apache from scratch.

Now, when I build PHP, I tend to put in a lot of things. Like:

./configure --with-mysql=/usr --with-openssl --with-pdflib=/usr/local --with
-bz2 --with-mhash --with-mcrypt ...

etc. etc. All of these modules are things that we use, but some of them not
very frequently.

So I'm trying to learn more about PHP's dynamic extensions. I didn't even
know that they existed, until I looked at the php.ini and phpinfo() output
of the PHP version that comes with RedHat 9.0. I see that instead of doing
things like:

./configure --with-mysql=/usr

they do

./configure --with-mysql=shared,/usr

So I guess my questions are:

1) Where can I learn more about PHP dynamic extensions? Maybe I'm looking
in the wrong places, but the documentation on them seems to be quite light.

2) Can *any* module be compiled as a dynamic extension, just by putting
"shared" in the appropriate place in the ./configure command? Or just a
few? How can you figure out which ones can, and which ones can't?

3) What are the advantages and disadvantages to making dynamic extensions?
I'm guessing that advantage=small er core PHP and disadvantage=sl ower initial
load time. Is that right? Anything else?

4) Similar to #3, is building dynamic extensions whenever possible
considered a Good Thing? Or are most people just still building everything
into a single monolithic libphp4.so ?

Thanks!


Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
22717
by: Alexandre Gillet | last post by:
Hi, I am trying to build a python interpreter that is static link. My python interpreter was build on RedHat 8.0 using gcc 2.3 and GLIBC 2.3 When running on other linux flavor that still have GLIBC 2.2, the interpreter won't start. (error message: /lib/libc.so.6: version `GLIBC_2.3' not found (required by /mgl/python/i86Linux2/bin/python2.3) Is there a way to build a static python interpreter using gcc 2.3 that can run on any machine...
8
6274
by: Randell D. | last post by:
Folks, I once read an article in Linux Format whereby a technical writer had made performance recommendations on a LAMP environment. One of the points raised was for small columns in a database, that one is perhaps better off to trade a small waste of space for a gain on performance - The recommendation said that when you use VARCHAR(3) that MySQL searches for disk space to take a record that will accept a variable length value up to...
14
2828
by: John Bentley | last post by:
Note this is crossposted to comp.lang.javacript and microsoft.public.dotnet.scripting. After some Googling and FAQing my understanding of these terms is, crudely: Javascript (3 different definitions): 1. The scripting language originally developed by Netscape. (I offer a Brief handle: "Original Netscape Script") 2. The current implementation of the ECMAscript 262 (3rd ed.) standard by Netscape. (I offer a brief handle: "Current...
19
3079
by: Geetesh | last post by:
Recently i saw a code in which there was a structer defination similar as bellow: struct foo { int dummy1; int dummy2; int last }; In application the above array is always allocated at runtime using malloc.In this last member of the structer "int last" is not
13
14616
by: Krivenok Dmitry | last post by:
Hello all! Perhaps the most important feature of dynamic polymorphism is ability to handle heterogeneous collections of objects. ("C++ Templates: The Complete Guide" by David Vandevoorde and Nicolai M. Josuttis. Chapter 14.) How to implement analogue of this technique via static polymorphism? Perhaps there is special design pattern for this purpose...
15
3194
by: Rob Meade | last post by:
Hi all, I have a databse which I'm pulling the data from for my ASP page. I have 4 tables, Course, Feature, Objective, and PreRequisite. The last three all contain a course product code and a text column - the course product code links the row(s) to the Course table. So, I might have 1 entry in Course, but perhaps 3 in Feature, 5 in Objective and 2 in PreRequisite.
1
2178
by: Will Ware | last post by:
I am trying to freeze a static executable. I built a static Python executable this way: ./configure --disable-shared --prefix=/usr/local make make install Even that didn't give me a really static executable, though: $ ldd /usr/local/bin/python linux-gate.so.1 => (0xffffe000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0xb7f44000) libdl.so.2 => /lib/libdl.so.2 (0xb7f40000)
20
6094
by: JohnQ | last post by:
The way I understand the startup of a C++ program is: A.) The stuff that happens before the entry point. B.) The stuff that happens between the entry point and the calling of main(). C.) main(). So, if the above is OK, does static initialization occur during A or B? What happens during A?
12
2721
by: subramanian100in | last post by:
Suppose class Base { public: virtual ~Test() { ... } // ... }; class Derived : public Base
0
8832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9566
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9388
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9333
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9254
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8256
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.