I apologies if this is the wrong place for asking. Is non-experimental
Apache2 support planned for PHP 5?
Marc
I apologies if this is the wrong place for asking. Is non-experimental
Apache2 support planned for PHP 5?
Nope. Until someone sits down and goes through every 3rd-party library
that can be linked into PHP on every platform and identifies whether or
not they are threadsafe and under which conditions they remain threadsafe,
using PHP in a threaded web server on UNIX is going to remain
experimental.
You can of course stick with non-threaded prefork mode, in which case you
basically have Apache-1.3.x. Nobody so far have been motivated to test
Apache2-prefork+PHP extensively, so even that combination is going to
remain experimental.
The basic problem here is that the average UNIX library has not been
written with thread safety in mind. You can write very good specific
threaded programs on UNIX, but it is extremely difficult to write
something which can potentially link in hundreds of random libraries and
expect them to all be threadsafe.
-Rasmus
Rasmus Lerdorf wrote:
Nope. Until someone sits down and goes through every 3rd-party library
that can be linked into PHP on every platform and identifies whether or
not they are threadsafe and under which conditions they remain threadsafe,
using PHP in a threaded web server on UNIX is going to remain
experimental.
From that, can I assume that using PHP by itself with no external
libraries is stable with Apache 2?
Is there a short list of some common extensions that do work reliably
with Apache 2? (eg MySQL, GD etc...)
Matt
Nope. Until someone sits down and goes through every 3rd-party library
that can be linked into PHP on every platform and identifies whether or
not they are threadsafe and under which conditions they remain threadsafe,
using PHP in a threaded web server on UNIX is going to remain
experimental.From that, can I assume that using PHP by itself with no external
libraries is stable with Apache 2?
It might be. We don't know and since none of us (that I know of at least)
would dream of running that combination in our own production environments
we won't know for a while. Until there is some compelling feature above
and beyond what can be done in the tried and true Apache-1.3.x code, I
don't see this situation changing.
Is there a short list of some common extensions that do work reliably
with Apache 2? (eg MySQL, GD etc...)
Nope. Make one. It's not all that easy to create such a list. Just take
a single library and go through it and tell me if it is threadsafe. Can
you do that? Do you know what to look for? If it is threadsafe on one
platform, do you think it is threadsafe on another? Does it depend on
which version of libc is on a platform? Does it depend on how it was
compiled?
We could of course mutex every call to every external function. Then we
could be reasonably sure it would work, and at the same time we could be
sure that it was much slower than running it non-threaded.
-Rasmus
We could of course mutex every call to every external function. Then we
could be reasonably sure it would work, and at the same time we could be
sure that it was much slower than running it non-threaded.
Any crash in an area protected by mutex would leave this mutex in
non-released state and all the rest threads trying to access that area would
be blocked forever.
Remember the problem of Win95<->Win 3.1 interoperability ?
BTW, is there any way for checking if a library does not create nor use any
global variables ? May be just running nm with non-stripped .so objects and
inspecting the resulting list ? Any other ideas ?
-Dmitri.
We could of course mutex every call to every external function. Then we
could be reasonably sure it would work, and at the same time we could be
sure that it was much slower than running it non-threaded.Any crash in an area protected by mutex would leave this mutex in
non-released state and all the rest threads trying to access that area would
be blocked forever.
A crash in a multi-threaded program most likely leads to the
termination of the process, so this is a non-issue.
BTW, is there any way for checking if a library does not create nor use any
global variables ? May be just running nm with non-stripped .so objects and
inspecting the resulting list ? Any other ideas ?
nm displays global variables, including static function-scope
variables. However, you cannot discern whether their use is
save unless you audit the source code. The latter is also
necessary, because a function can rely on external
non-reentrant functions which renders the caller itself
non-reentrant.
- Sascha
We could of course mutex every call to every external function. Then
we
could be reasonably sure it would work, and at the same time we could
be
sure that it was much slower than running it non-threaded.Any crash in an area protected by mutex would leave this mutex in
non-released state and all the rest threads trying to access that area
would
be blocked forever.A crash in a multi-threaded program most likely leads to the termination of the process, so this is a non-issue.
Okay. Suppose it's the best solution to avoid hangs.... :-)
BTW, is there any way for checking if a library does not create nor use
any
global variables ? May be just running nm with non-stripped .so objects
and
inspecting the resulting list ? Any other ideas ?nm displays global variables, including static function-scope variables. However, you cannot discern whether their use is save unless you audit the source code.
I agree but I meant different thing.
Everybody understand that sources must be audited but nobody want to do it
just because
they are too big and all the process would be just wasting the time. At
least withought
cliear understanding what to do after a snapshot is audited. Nobody would
like to do the same work twice.
Look, if a library (or function) does not use global variables nor call to
other functions that are explicitly marked as a
non-reentrant (should a list be opened for it?), this library can be safely
used in multithreaded
environment and thus the list of remained code to be audited
can be made fewer. Isn't it ? Don't you agree that it's nearly impossible to
audit all the code including
all the extensions. Even if anybody audited a particular snapshot of all
sources what to do with it
after other people have made modifications ? I believe there must be an
automated process that
should be tightly integrated in to building scripts. As a result we should
get a list of all functions with
one of the following "CLEAR" "TO BE AUDITED" "NON REENTRANT".
Any further ideas ?
-dmitri.
Matt Parlane wrote:
From that, can I assume that using PHP by itself with no external
libraries is stable with Apache 2?
I don't think so...
http://bugs.php.net/bug.php?id=16820 is still open. But if you don't
limit time for scripts it should work.
regards,
Wojtek