Re: [PHP4BETA] Running PHP3 and PHP4
| From: | Sascha Schumann | Date: | Tue, 07 Sep 1999 22:34:26 +0000 |
| Subject: | Re: [PHP4BETA] Running PHP3 and PHP4 | ||
| References: | 1 2 3 4 5 6 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-4221@lists.php.net to get a copy of this message | ||
On Tue, Sep 07, 1999 at 11:22:43PM +0200, Zeev Suraski wrote:
> At 23:09 07/09/1999 , Sascha Schumann wrote:
> > I don't know exactly how versioning works in i.e. the C
> > library, but I do know that it's completely transparent to
> > users and developers.
> >
> > I see this as a benefit - if it's easy to realize and it
> > doesn't interfere with other parts because of technical
> > reasons, there is hardly any chance of doing something wrong.
>
> Well, if you could supply some more concrete information on this versioning
> method, it may change my opinion.
The so-called versioning is a method where you can assign
symbols a certain version (status) in a shared library.
For example, you might have a function called X in php3 and
php4. Without versioning, the linker would not be able to
choose the correct one (if there is a "correct" one at all).
Versioning allows you now what you could do manually by
prefixing symbol names with php3_ or php4_. The difference is
that versioning works transparently. The dynamic linker
decides at run-time which undefined reference to bind to
which symbol by using the versioning information.
Let's look at a practical example. We've got two libraries,
called 1 and 2 which contain the symbol "dummy". We have an
object file which accesses a symbol "dummy". This object file
is now linked against lib 1 or 2 and stored in 1.so or 2.so,
respectively.
$ nm 1.so | grep dummy
U dummy@@VER1
$ nm 2.so | grep dummy
U dummy@@VER2
You see that there is still a reference to dummy, but the
reference includes additional information. This information
is used by the dynamic linker to find the correct symbol.
Therefore, both shared objects could be used within the same
executable.
Versioning is supported on Solaris 2.x and in recent GNU
binutils.
> There are things that will simply not work right, though, because they're
> 'not meant to be'. For example, the Sybase library isn't supposed to be
> initialized twice within the same process; If you have both PHP 3.0 and
> 4.0 in the same server, it may fuck up. I'm sure there are plenty of such
> cases, where running two versions of the same thing within the same process
> will cause problems.
Yes, that's a problem. I don't think that's our problem
though.
> Considering the number of issues raised by using CGI binaries (almost none)
> - I don't think it's that much of a necessity to support running both 3.0
> and 4.0 within the same server as modules. You can run 3.0 as a CGI and
> 4.0 as a module or vice versa, and rarely will this pose any limitations.
Well, to produce a versioned shared library (i.e. for APXS),
we need to pass one additional linker flag and create a
version script:
PHPV4 {
global: *
};
`info ld', node "Version Script" contains more information.
--
Regards,
Sascha Schumann
Consultant