473,769 Members | 6,799 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Are PHP libraries linked dynamically or statically?

Hi,

When a PHP program links to a library using include or require (or their
_once variations), is the library then linked dynamically or statically?

While it might seem irrelevant from a technical point of view, the
linking method is important when it comes to licencing issues as some
licences, like GPL, differ between those kinds of linking when it comes
to viewing the library as a derivative work of the main program.

Therefore it is quite important to know what kind of linking is in
effect when including libraries, and I hope someone in this group can
shed some light on this matter.

Thank you very much in advance,
Martin
Jul 19 '07 #1
36 3200
NC
On Jul 19, 4:14 pm, Martin Larsen <martin+spamfre e+lar...@bigfoo t.com>
wrote:
>
When a PHP program links to a library using include
or require (or their _once variations), is the library
then linked dynamically or statically?
Neither. include/require is not a linking mechanism; it is a way to
assemble a complete block of source code prior to its interpretation.
Any static linking takes place at the server process start-up (i.e.,
before any include/require can happen); dynamic linking (if any)
occurs during execution (i.e., after the source code has been
interpreted, and, therefore, after any include/require).
it is quite important to know what kind of linking is in
effect when including libraries,
Only if the libraries are true libraries (i.e., those compiled into
native executable code). With PHP "libraries" , using include/require
does not imply any linking...

Cheers,
NC

Jul 20 '07 #2
Martin Larsen wrote:
When a PHP program links to a library using include or require (or their
_once variations), is the library then linked dynamically or statically?
Dynamically.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 29 days, 14:30.]

Parsing an HTML Table with PEAR's XML_HTTPSax3
http://tobyinkster.co.uk/blog/2007/0...table-parsing/
Jul 20 '07 #3
Thanks NC,

I understand that PHP is very different than say a Windows executable,
and perhaps linking is not the right term for what happens.

Anyway, in your opinion, does the mechanism rememble dynamic or static
linking most?

Btw, if I were to get an "official" statement, do you by chance know who
I should contact?

Martin
Jul 20 '07 #4
NC
On Jul 20, 12:34 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
>
I understand that PHP is very different than say a Windows
executable,
PHP isn't (it can be a Windows executable). PHP scripts are.

Not quite true. The PHP interpreter (php.exe) itself is executable.
My point exactly. I guess I should have written "PHP interpreter"
rather than just "PHP"... :)

Cheers,
NC

Jul 20 '07 #5
NC wrote:
>Btw, if I were to get an "official" statement, do you by
chance know who I should contact?

The PHP group: http://www.php.net/contact.php
Thanks for link. However, that page actually refers to this newsgroup or
the webmaster for website related comments.

Is there a way to contact the PHP Group directly?

Thanks again,
Martin
Jul 21 '07 #6
Hi Henk,
This may be true from a strict technical definition, but juridical
reasoning may not be that strict.
Thank you for making clear what I was trying to say. It is in fact a
juridical matter.

If we agree that the term linking might not be entirely irrelevant,
which kind of linking would you say is in effect when a PHP program
links to a script: dynamically or statically.

The reason why this is important is that dynamically linking is often
seen as a licence boundary
(http://en.wikipedia.org/wiki/Library...ynamic_linking)

Regards,
Martin
Jul 21 '07 #7
Martin Larsen wrote:
Hi Henk,
>This may be true from a strict technical definition, but juridical
reasoning may not be that strict.

Thank you for making clear what I was trying to say. It is in fact a
juridical matter.

If we agree that the term linking might not be entirely irrelevant,
which kind of linking would you say is in effect when a PHP program
links to a script: dynamically or statically.

The reason why this is important is that dynamically linking is often
seen as a licence boundary
(http://en.wikipedia.org/wiki/Library...ynamic_linking)

Regards,
Martin
And despite what Henk posted, has absolutely nothing to do with PHP.

NC is correct in his discussion. You need to paying attention to what
he is saying.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jul 21 '07 #8
Martin Larsen wrote:
NC wrote:
>>Btw, if I were to get an "official" statement, do you by
chance know who I should contact?

The PHP group: http://www.php.net/contact.php

Thanks for link. However, that page actually refers to this newsgroup or
the webmaster for website related comments.

Is there a way to contact the PHP Group directly?

Thanks again,
Martin
Why?

If you understood the technology, the answer would be clear. Rather, I
suggest you visit your local library or bookstore and find out how
interpreters work.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jul 21 '07 #9
Jerry Stuckle wrote:
Unless you have implemented a PHP optimizer, every PHP file is
interpreted every time you load the file. There is no intermediate code.
There normally *is* an intermediate form, but it's discarded after each
execution unless you have a PHP cache, such as eAccelerator.

That is, on each execution, the PHP interpreter:

1. Opens up the file;
2. Tokenises it, storing the token stream in memory;
3. Parses it into a form of byte code, storing that in
memory too; then
4. Executes the byte code.

Most smart interpreters (and I assume PHP is included here) will also
perform a bit of code optimisation around stage 3 too. Code optimisation
trades off execution time for parsing time, so interpreters (optimise once,
run once) tend not to optimise as much as compilers (optimise once, run
many) do.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 30 days, 12:01.]

Parsing an HTML Table with PEAR's XML_HTTPSax3
http://tobyinkster.co.uk/blog/2007/0...table-parsing/
Jul 21 '07 #10

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

Similar topics

1
1844
by: Kwan | last post by:
Hi All, In a Unix system (I am using Solaris, but not limited to it), who will dynamically linked libraries been linked to a multithreaded process? Will it have a different instance for every single thread, or just one copy and shared amough all threads? I have some static member variables in the class suggested that every single threads is having their own instance. Is that true?
3
10320
by: daniel_shaw01 | last post by:
I want to link the C++ standard libraries statically for my application because I don't space for the .so files on my target platform. After quite a bit of searching, I found very little information that was helpful. The best information I found was at this link http://fresco.org/~njs/c++-without-stdc++ I followed the approach here and used -nostdlib to disable the default linking. Instead I use the options:
4
2270
by: RobG | last post by:
I have a function whose parameter is a reference the element that called it: function someFunction(el) { ... } The function is assigned to the onclick event of some elements in the HTML source:
13
1561
by: tsoukase | last post by:
Hello, two questions: 1) Why is a library a collection of compiled source-files while each header-file is a single source? Would it be more efficient if they were both either compiled or not? Could a "header-library" exist? 2) Why do libraries have extensions .a and .so and modules .o, which should be reserved for cc -c output? Would it be better: module.m, lib.sl, lib.dl or something
7
5213
by: Steve | last post by:
Hi, We have an application framework library that gets statically linked to any applications we produce. (Windows apps, but I don't think that matters here). The framework is based heavily on the STL and the API uses many STL constructs. Because of the static linking, and the fact that both app and framework are built by the same compiler, we don't have any problems.
8
2080
by: bonk | last post by:
Is it generally OK for an EXE that has MFC linked statically to load an use another DLL wich has MFC linked as shared DLL ? To be more specific: I have an EXE that links a lib. Let's call it mylib.lib. That Lib as well as the EXE have MFC linked statically. Then in a completely different project I have a regular DLL, wich is compiled with the /CLR switch and therefore needs the special CRT libs as
4
1635
by: utab | last post by:
Dear all, I want to be able to use C++ libraries(maybe this is too abstract). Is there a source or tutorial giving the general details on the use of C++ libraries. (Sth like, to use all C++ libraries you have to complete these common steps and make the following configurations according to your OS.) I am looking for a step-by-step introduction to library usage. I also checked out the boost web page which seemed to me a bit confusing.
5
1961
by: Chris | last post by:
I have a page with mixture of static and dynamically added controls is there any way of controlling the order which they are added to the page. My submit button (statically added) appears before some textboxes (dynamically added). I know I could move it around with CSS but I want to move towards an accessible site that will display forms in the right order without CSS. Regards, Chris.
20
2143
by: pratap | last post by:
Could someone clarify how could one reduce the size of an executable code during compile time. Could one use specific compile time flag with makefile or is it advisable to go for dynamic linking. The idea here is that smaller the code size the faster is the code. Is Dynamically linked executable really faster than a single executable file which is not linked dynamically.? Is there any performance measuring metrics on gcc version 3.2.2
0
10223
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
10051
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
10000
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
9866
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
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3968
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
3571
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.