RE: [INTERNALS-WIN] RE: [PHP-DEV] Differences in VC6 and VC9 Windows builds and MSSQL Driver.

[email protected] ("Uwe Schindler")
Newsgroups php.internals.win
Message-ID <89DC708F680441ADB316026EDB559982@VEGA>
> On Mon, Jan 5, 2009 at 10:37 PM, Uwe Schindler <[email protected]> wrote:
> > Hi Pierre,
> >
> > I can prepare a test with a copy of Mediawiki and Contenido CMS from our
> > productive Solaris SJSWS, both can be ported to win32 easily (dump of
> > database and copy of webserver config files and PHP scripts). This takes
> > some time, but is do-able.
> >
> > Both software pieces are multithread compatible, because both run
> currently
> > in our multithreaded NSAPI server productive (on solaris, with a lot of
> hits
> > per second). So there is no difference to windows.
> 
> PHP behaviors inside the NSAPI using different CRT interests me, actually
> :)

I understand that. For NSAPI the whole thing is very simple:

- The webserver calls NSAPI on startup. During this phase no resources of
CRTs are exchanged. So The webserver has his CRT, PHP the other, no
interaction. The webserver only calls a function from the PHP DLL, the
parameters to this function are webserver-private (no relation to CRT). This
call is working without problems and can be easily tested with any instance
of webserver/PHP (there is no load/traffic/...). PHP registers a shutdown
callback at the webserver, that is called on shutdown from webserver. The
parameters to this function are webserver-private, too (no CRT involved).

- When a request arrives, the webserver calls a function from the PHP DLL.
The parameters to this function are also webserver-private. The only
non-private part is one "struct stat" in the mentioned request structure.
PHP interprets this structure directly on request initialization. If the
size of this struct changes or is anything different, the webserver would
crash on request startup or would not accept the script (because ISREG on
this struct for checking if file available would not work). This does not
happen because "struct stat" is equal in both CRTs. This is not different on
high load or if some extensions are loaded or whatever. All string pointers
and so on, the webserver has in this request struct, are copied with
module-private functions or estrdup() and so on. No pointers from webserver
are freed. Handles (e.g. the handle to the output stream) are *windows
handles* that come directly from kernel32.dll (and are so invariant to CRT).
As soon as the PHP script starts, PHP is using his resources alone. When PHP
starts to write output to the client, SAPI calls a NSAPI functions that is
again webserver-private and only uses a handle (see above) to the socket as
parameter.

- If the PHP script would call virtual(), again four NSAPI functions from
the webserver are called, only accepting pointers to these webserver-private
request structures, again no problem with different CRTs. And no difference
between high traffic and load... :) [its always the same].

You can say: PHP and the webserver are doing there parts on their own, the
interaction is minimal and during this interaction, no CRT resources are
exchanged (and the only problematic part is identical in both CRTs) - in
both header files the same "struct stat". And I am not really sure, if
struct stat is declared in CRT, or if it is a struct coming from the windows
kernel (kernel32.dll). But nevertheless, they are identical.

I hope these explanations are enough. I thought the whole nights on the last
weekend about it :-].

> > Nevertheless, can you please enable VC9 for NSAPI to have a more actual
> > codebase for testing?
> 
> Sure, I only did not get the time to do it today. It should be in
> place otmorrow :)

Thanks!

Uwe
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.