On 02/28/2012 08:51 AM, William A. Rowe Jr. wrote:
On 2/27/2012 6:46 PM, Christopher Jones wrote:

On 02/27/2012 01:12 PM, William A. Rowe Jr. wrote:
On 2/27/2012 6:58 AM, jpauli wrote:

Recently we had a bug with the new Apache 2.4 API where apxs doesn't answer
about the MPM configuration anymore, leading to a ZTS build by default.
This bug has now been fixed, was https://bugs.php.net/bug.php?id=61172.

Wrong fix.  Out of the box you don't know which mpm may be loaded, because
the mpm is now loadable (although a full daemon stop/start is necessary).

Can you expand&  explain this, with an eye to resolving 61172?
Are you saying Apache 2.4 'httpd -M' might not return the mpm?

The mpm is now a loadable module, not compiled in.  The recommended default mpm
is now event, the recommended .rpm proposes shipping event/worker/prefork, all
as modules.  The user is *free* to switch mpm's at any point by simply editing
their httpd.conf file, so what was a non-threaded server becomes a threaded one.

httpd -l will not return what you want, httpd -M will, but is not the right
solution...

# bin/httpd -l
Compiled in modules:
   core.c
   mod_so.c
   http_core.c

# bin/httpd -M
Loaded Modules:
  core_module (static)
  so_module (static)
  http_module (static)
...
  version_module (shared)
  mpm_event_module (shared)
  unixd_module (shared)
...

The httpd -V command was always the correct way to test for threaded'ness,
which would allow supporting an mpm which was not known to you.  Again, it
will only reflect the currently loaded module (and fail if no MPM is loaded);

# bin/httpd -V
Server version: Apache/2.4.1 (Unix)
Server built:   Feb 28 2012 10:37:32
Server's Module Magic Number: 20120211:0
Server loaded:  APR 1.4.5, APR-UTIL 1.3.12
Compiled using: APR 1.4.5, APR-UTIL 1.3.12
Architecture:   64-bit
Server MPM:     event
   threaded:     yes (fixed thread count)
     forked:     yes (variable process count)
...

Editing httpd.conf... s/event/prefork/ results in
...
Server MPM:     prefork
   threaded:     no
     forked:     yes (variable process count)

In 2.2 the default MPM became worker.  In 2.4 the default MPM is now event,
so prefork hasn't been the default in some 7 years.  The only sensible build
for mod_php is ZTS, which will load and operate whichever mpm is loaded by
the user.  The only sensible single thread environment is cgi (enhanced,
of course, with fastcgi!)


Thanks for clarifying that there is nothing unexpected (to me)
happening and for suggesting using -V.

It seems that the PHP installer could do one of two things:

1. Build PHP for the currently installed Apache MPM, using "httpd -V"
   to identify whether to enable PHP's ZTS mode or not.  PHP
   documentation and/or 'configure' messages should state the MPM
   shouldn't later be changed to threaded if it was originally
   prefork.  A proviso about ZTS overhead and limitations could be
   noted.

2. Build PHP with ZTS enabled by default.  Allow it to be explicitly
   disabled during 'configure'

There are some variations of the above, depending on the target
audience(s) and scope of perceived problem.

Chris

--
Email: christopher.jo...@oracle.com
Tel:  +1 650 506 8630
Blog:  http://blogs.oracle.com/opal/

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to