Compiling 2 SAPIs

php.internals

Brian J. France

22 years ago
> I have a project where I need to have both Apache SAPI (shared) and > embed SAPI (shared) compiled/active at the same time. Is that possible > to do at all? Any risk of symbol clashes or other similar problems?
Andrei posted this a while ago, but nobody replied and we have learned this is it not possible. With the current state of the code and configuration system what would it take to do something like this: Core PHP code is built into libphpX.so (libphp4.so) All SAPI's require libphpX.so: libphpX_apache.so <- apache sapi libphpX_embeded.so <- apache sapi and the command line sapi would have a depenency on libphpX.so. Brian

Andrei Zmievski

22 years ago
On Mon, 26 Jan 2004, Brian J. France wrote:
> Andrei posted this a while ago, but nobody replied and we have learned > this is it not possible. > > With the current state of the code and configuration system what would > it take to do something like this: > > Core PHP code is built into libphpX.so (libphp4.so) > > All SAPI's require libphpX.so: > > libphpX_apache.so <- apache sapi > libphpX_embeded.so <- apache sapi > > and the command line sapi would have a depenency on libphpX.so.
I guess not too many people are interested in something like this.. - Andrei

George Schlossnagle

22 years ago
On Jan 26, 2004, at 5:10 PM, Andrei Zmievski wrote:
> On Mon, 26 Jan 2004, Brian J. France wrote: >> Andrei posted this a while ago, but nobody replied and we have learned >> this is it not possible. >> >> With the current state of the code and configuration system what would >> it take to do something like this: >> >> Core PHP code is built into libphpX.so (libphp4.so) >> >> All SAPI's require libphpX.so: >> >> libphpX_apache.so <- apache sapi >> libphpX_embeded.so <- apache sapi >> >> and the command line sapi would have a depenency on libphpX.so. > > I guess not too many people are interested in something like this..
I remember a thread about this about a year ago. Sascha's answer was something along the lines of 'build it twice if that's what you want'. Can't find the thread though. George

Marcus Börger

22 years ago
Hello Brian, Monday, January 26, 2004, 10:37:56 PM, you wrote:
>> I have a project where I need to have both Apache SAPI (shared) and >> embed SAPI (shared) compiled/active at the same time. Is that possible >> to do at all? Any risk of symbol clashes or other similar problems?
> Andrei posted this a while ago, but nobody replied and we have learned > this is it not possible.
> With the current state of the code and configuration system what would > it take to do something like this:
> Core PHP code is built into libphpX.so (libphp4.so)
> All SAPI's require libphpX.so:
> libphpX_apache.so <- apache sapi > libphpX_embeded.so <- apache sapi
> and the command line sapi would have a depenency on libphpX.so.
Sounds nice to me. But are you willing to work out a patch for that so that we can play with it? Or do you anyone in mind who could do that change and has some time for it? Best regards, Marcus mailto:helly@php.net

Jani Taskinen

22 years ago
On Mon, 26 Jan 2004, Brian J. France wrote:
>> I have a project where I need to have both Apache SAPI (shared) and >> embed SAPI (shared) compiled/active at the same time. Is that possible >> to do at all? Any risk of symbol clashes or other similar problems? > >Andrei posted this a while ago, but nobody replied and we have learned >this is it not possible. > >With the current state of the code and configuration system what would >it take to do something like this: > >Core PHP code is built into libphpX.so (libphp4.so) > >All SAPI's require libphpX.so: > >libphpX_apache.so <- apache sapi >libphpX_embeded.so <- apache sapi > >and the command line sapi would have a depenency on libphpX.so.
Here's what I came up with: http://www.php.net/~jani/patches/multi_sapi_build.patch With the patch applied, I'm now able to build at least apache, cli, cgi and embed SAPIs on one run. # ./configure --disable-all --with-apxs --enable-embed (CLI and CGI are build by default..) I build them using static 'core' lib as I dislike the idea of having to install and maintain several libs. :) But if someone insists, it's possible to build one shared lib too..I actually tested with that first. :) --Jani

Andrei Zmievski

22 years ago
On Tue, 27 Jan 2004, Jani Taskinen wrote:
> Here's what I came up with: > > http://www.php.net/~jani/patches/multi_sapi_build.patch > > With the patch applied, I'm now able to build at least > apache, cli, cgi and embed SAPIs on one run. > > # ./configure --disable-all --with-apxs --enable-embed > > (CLI and CGI are build by default..) > > I build them using static 'core' lib as I dislike the > idea of having to install and maintain several libs. :) > > But if someone insists, it's possible to build one shared > lib too..I actually tested with that first. :)
Does your patch just build multiple SAPIs as separate shared libs or does it make one shared lib that has multiple SAPIs in it? The latter is what I want. The best (ideal) result would be to have one libphp[45].so that contains the core. The SAPIs should link against it, so we'd have libphpembed.so, libphpapache.so, etc. Can this be done? - Andrei

Uwe Schindler

22 years ago
At 17:40 27.01.2004, you wrote:
>On Tue, 27 Jan 2004, Jani Taskinen wrote: > > Here's what I came up with: > > > > http://www.php.net/~jani/patches/multi_sapi_build.patch > > > > With the patch applied, I'm now able to build at least > > apache, cli, cgi and embed SAPIs on one run. > > > > # ./configure --disable-all --with-apxs --enable-embed > > > > (CLI and CGI are build by default..) > > > > I build them using static 'core' lib as I dislike the > > idea of having to install and maintain several libs. :) > > > > But if someone insists, it's possible to build one shared > > lib too..I actually tested with that first. :) > >Does your patch just build multiple SAPIs as separate shared libs or >does it make one shared lib that has multiple SAPIs in it? The latter is >what I want. > >The best (ideal) result would be to have one libphp[45].so that contains >the core. The SAPIs should link against it, so we'd have libphpembed.so, >libphpapache.so, etc. Can this be done?
Would be great. The only thing is: We must compile all SAPIs with ZTS enabled... But thats the same on windows. ----- Uwe Schindler thetaphi@php.net - http://www.php.net NSAPI SAPI developer Erlangen, Germany

Andrei Zmievski

22 years ago
On Tue, 27 Jan 2004, Uwe Schindler wrote:
> Would be great. The only thing is: We must compile all SAPIs with ZTS > enabled... But thats the same on windows.
Well, maybe we can have a ZTS and a non-ZTS version of the core lib. - Andrei

George Schlossnagle

22 years ago
On Jan 27, 2004, at 12:02 PM, Andrei Zmievski wrote:
> On Tue, 27 Jan 2004, Uwe Schindler wrote: >> Would be great. The only thing is: We must compile all SAPIs with ZTS >> enabled... But thats the same on windows. > > Well, maybe we can have a ZTS and a non-ZTS version of the core lib.
That seems like a nice standard way of handling it. George

Wez Furlong

22 years ago
That is also how the new win32 build system handles it; you have the option of php5ts.dll or php5.dll. --Wez.

Jani Taskinen

22 years ago
On Tue, 27 Jan 2004, Andrei Zmievski wrote:
>On Tue, 27 Jan 2004, Uwe Schindler wrote: >> Would be great. The only thing is: We must compile all SAPIs with ZTS >> enabled... But thats the same on windows. > >Well, maybe we can have a ZTS and a non-ZTS version of the core lib.
Yes, but it makes no sense to build both on same run as you'd have to build the core objects twice.. --Jani

Jani Taskinen

22 years ago
On Tue, 27 Jan 2004, Andrei Zmievski wrote:
>On Tue, 27 Jan 2004, Jani Taskinen wrote: >> Here's what I came up with: >> >> http://www.php.net/~jani/patches/multi_sapi_build.patch >> >> With the patch applied, I'm now able to build at least >> apache, cli, cgi and embed SAPIs on one run. >> >> # ./configure --disable-all --with-apxs --enable-embed >> >> (CLI and CGI are build by default..) >> >> I build them using static 'core' lib as I dislike the >> idea of having to install and maintain several libs. :) >> >> But if someone insists, it's possible to build one shared >> lib too..I actually tested with that first. :) > >Does your patch just build multiple SAPIs as separate shared libs or >does it make one shared lib that has multiple SAPIs in it? The latter is >what I want.
It creates a static libphp5_core.a which is linked to each build SAPI module / binary. Dunno how you could have same lib loaded by e.g. Apache / Apache2 ?? Or what did you mean? :)
>The best (ideal) result would be to have one libphp[45].so that contains >the core. The SAPIs should link against it, so we'd have libphpembed.so, >libphpapache.so, etc. Can this be done?
My first tests had the libphp5_core lib as shared..so yes. I'll update my patch a bit. --Jani

Andrei Zmievski

22 years ago
On Wed, 28 Jan 2004, Jani Taskinen wrote:
> It creates a static libphp5_core.a which is linked to each build > SAPI module / binary. Dunno how you could have same lib loaded > by e.g. Apache / Apache2 ?? Or what did you mean? :) > > >The best (ideal) result would be to have one libphp[45].so that contains > >the core. The SAPIs should link against it, so we'd have libphpembed.so, > >libphpapache.so, etc. Can this be done? > > My first tests had the libphp5_core lib as shared..so yes. > I'll update my patch a bit.
Okay, is it possible to make the same patch for php4? - Andrei

Jani Taskinen

22 years ago
On Wed, 28 Jan 2004, Andrei Zmievski wrote:
>On Wed, 28 Jan 2004, Jani Taskinen wrote: >> It creates a static libphp5_core.a which is linked to each build >> SAPI module / binary. Dunno how you could have same lib loaded >> by e.g. Apache / Apache2 ?? Or what did you mean? :) >> >> >The best (ideal) result would be to have one libphp[45].so that contains >> >the core. The SAPIs should link against it, so we'd have libphpembed.so, >> >libphpapache.so, etc. Can this be done? >> >> My first tests had the libphp5_core lib as shared..so yes. >> I'll update my patch a bit. > >Okay, is it possible to make the same patch for php4?
I didn't try, but I think the same patch might even apply without modifying it at all. :) The build stuff is pretty much same in both HEAD and PHP_4_3 branches, AFAICT. --Jani