Discussion:
lang/php{54,55} and www/apache24 does not work without ZTS support
Ryo ONODERA
2014-03-17 13:44:22 UTC
Permalink
Hi,

php-5.3.28nb2, php-5.4.26 and php-5.5.10 do not work with Apache httpd 2.4.7.

Here is error message.

[Mon Mar 17 20:49:54.145101 2014] [:crit] [pid 19026:tid 140187728347136] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.
AH00013: Pre-configuration failed


PKG_OPTIONS=maintainer-zts (CONFIGURE_ARGS+=--enable-maintainer-zts) for
php5* and ap-php helps this error.

Can I add maintainer-zts to PKG_SUGGESTED_OPTIONS?
Or any other solution?

Thank you.

--
Ryo ONODERA // ***@yk.rim.or.jp
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB FD1B F404 27FA C7D1 15F3
Greg Troxel
2014-03-17 14:22:29 UTC
Permalink
Post by Ryo ONODERA
php-5.3.28nb2, php-5.4.26 and php-5.5.10 do not work with Apache httpd 2.4.7.
Here is error message.
[Mon Mar 17 20:49:54.145101 2014] [:crit] [pid 19026:tid 140187728347136] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.
AH00013: Pre-configuration failed
Is this new breakage, or have our php packages/modules always not worked
with apache24?

Is using a threaded MPM just the way apache24 is, or is this some sort
of configuration option?
Post by Ryo ONODERA
PKG_OPTIONS=maintainer-zts (CONFIGURE_ARGS+=--enable-maintainer-zts) for
php5* and ap-php helps this error.
But what else does it change? Is there some reason our php has been
compiled without the threads option before?

But I see that
/usr/pkg/bin/php
/usr/pkg/libexec/cgi-bin/php:

are linked with threads already (in php53), but apparently that's different.

I tried to build php53 with that option, and the build failed.

I'd like to hear comments from other php/apache users/experts, too.
matthew sporleder
2014-03-17 14:49:33 UTC
Permalink
Post by Greg Troxel
Post by Ryo ONODERA
php-5.3.28nb2, php-5.4.26 and php-5.5.10 do not work with Apache httpd 2.4.7.
Here is error message.
[Mon Mar 17 20:49:54.145101 2014] [:crit] [pid 19026:tid 140187728347136] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.
AH00013: Pre-configuration failed
Is this new breakage, or have our php packages/modules always not worked
with apache24?
Is using a threaded MPM just the way apache24 is, or is this some sort
of configuration option?
Post by Ryo ONODERA
PKG_OPTIONS=maintainer-zts (CONFIGURE_ARGS+=--enable-maintainer-zts) for
php5* and ap-php helps this error.
But what else does it change? Is there some reason our php has been
compiled without the threads option before?
But I see that
/usr/pkg/bin/php
are linked with threads already (in php53), but apparently that's different.
I tried to build php53 with that option, and the build failed.
I'd like to hear comments from other php/apache users/experts, too.
It's like an all-or-nothing approach, afaik. Each module compiled
from then on will also need zts support.

I think it's off by default because third party modules aren't all
necessarily thread safe from the c -> php -> pecl chain.
- this may be outdated FUD at this point, but it's the assumption I've
been working with for the past few years.

In the case of apache24 I highly recommend using mpm_event and
php_fpm instead of mod_php.

Matt
Ryo ONODERA
2014-03-17 15:00:51 UTC
Permalink
Post by matthew sporleder
Post by Greg Troxel
Post by Ryo ONODERA
php-5.3.28nb2, php-5.4.26 and php-5.5.10 do not work with Apache httpd 2.4.7.
Here is error message.
[Mon Mar 17 20:49:54.145101 2014] [:crit] [pid 19026:tid 140187728347136] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.
AH00013: Pre-configuration failed
Is this new breakage, or have our php packages/modules always not worked
with apache24?
Is using a threaded MPM just the way apache24 is, or is this some sort
of configuration option?
Post by Ryo ONODERA
PKG_OPTIONS=maintainer-zts (CONFIGURE_ARGS+=--enable-maintainer-zts) for
php5* and ap-php helps this error.
But what else does it change? Is there some reason our php has been
compiled without the threads option before?
But I see that
/usr/pkg/bin/php
are linked with threads already (in php53), but apparently that's different.
I tried to build php53 with that option, and the build failed.
I'd like to hear comments from other php/apache users/experts, too.
It's like an all-or-nothing approach, afaik. Each module compiled
from then on will also need zts support.
I think it's off by default because third party modules aren't all
necessarily thread safe from the c -> php -> pecl chain.
- this may be outdated FUD at this point, but it's the assumption I've
been working with for the past few years.
In the case of apache24 I highly recommend using mpm_event and
php_fpm instead of mod_php.
I have not tested php-fpm.
I will try to use it.

Thank you.

--
Ryo ONODERA // ***@yk.rim.or.jp
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB FD1B F404 27FA C7D1 15F3
Amitai Schlair
2014-03-17 22:44:10 UTC
Permalink
On Mon, Mar 17, 2014 at 10:49 AM, matthew sporleder
Post by matthew sporleder
In the case of apache24 I highly recommend using mpm_event and
php_fpm instead of mod_php.
I've done this and things appear happy again, at least in my basic usage.

What I used to do: www/apache24, www/php55, www/ap-php. The last
working configuration was with packages built from pkgsrc-current
around mid-February.

What I tried: upgrading to packages built from pkgsrc-current around
now. I got errors like ryoon@'s (plus others from certain PHP
extensions).

What worked instead: I installed www/php-fpm, started it from
/etc/rc.d, and followed the configuration instructions mspo@ pointed
me at off-list: <URL:http://wiki.apache.org/httpd/PHP-FPM>

I feel better with FastCGI than with webserver-specific modules
anyway, and with the instructions it was really easy to switch.
Matthias Scheler
2014-03-22 00:12:01 UTC
Permalink
Post by Amitai Schlair
What worked instead: I installed www/php-fpm, started it from
/etc/rc.d, ...
The package in "pkgsrc" doesn't seem to have an "rc.d" script as far
as I can tell. Could you perhaps add yours to the package?

Thanks in advance
--
Matthias Scheler https://zhadum.org.uk/
Amitai Schlair
2014-03-22 00:33:13 UTC
Permalink
Post by Matthias Scheler
Post by Amitai Schlair
What worked instead: I installed www/php-fpm, started it from
/etc/rc.d, ...
The package in "pkgsrc" doesn't seem to have an "rc.d" script as far
as I can tell. Could you perhaps add yours to the package?
Might you be having trouble with your cvs checkout? I've got a
files/php-fpm.sh, and according to cvsps it's been there since
fhajny's initial import a couple years ago.
Matthias Scheler
2014-03-22 01:13:22 UTC
Permalink
Post by Amitai Schlair
Post by Matthias Scheler
Post by Amitai Schlair
What worked instead: I installed www/php-fpm, started it from
/etc/rc.d, ...
The package in "pkgsrc" doesn't seem to have an "rc.d" script as far
as I can tell. Could you perhaps add yours to the package?
Might you be having trouble with your cvs checkout? I've got a
files/php-fpm.sh, and according to cvsps it's been there since
fhajny's initial import a couple years ago.
No, I could fooled by the lack of an "rc.d" script in "PLIST".
It seems they don't get listed there. Sorry for the confusion.

Kind regards
--
Matthias Scheler https://zhadum.org.uk/
Jonathan Perkin
2014-03-22 08:14:32 UTC
Permalink
Post by Matthias Scheler
Post by Amitai Schlair
Post by Matthias Scheler
Post by Amitai Schlair
What worked instead: I installed www/php-fpm, started it from
/etc/rc.d, ...
The package in "pkgsrc" doesn't seem to have an "rc.d" script as far
as I can tell. Could you perhaps add yours to the package?
Might you be having trouble with your cvs checkout? I've got a
files/php-fpm.sh, and according to cvsps it's been there since
fhajny's initial import a couple years ago.
No, I could fooled by the lack of an "rc.d" script in "PLIST".
It seems they don't get listed there. Sorry for the confusion.
They were removed as part of the INIT_SYSTEM and SMF support
integration a couple of weeks ago. They are now automatically
generated if INIT_SYSTEM == "rc.d" (the default).

See "Introducing SMF support" threads to this list for more details.
--
Jonathan Perkin - Joyent, Inc. - www.joyent.com
Ryo ONODERA
2014-03-17 14:51:03 UTC
Permalink
Post by Greg Troxel
Post by Ryo ONODERA
php-5.3.28nb2, php-5.4.26 and php-5.5.10 do not work with Apache httpd 2.4.7.
Here is error message.
[Mon Mar 17 20:49:54.145101 2014] [:crit] [pid 19026:tid 140187728347136] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.
AH00013: Pre-configuration failed
Is this new breakage, or have our php packages/modules always not worked
with apache24?
Oops. This breakage is caused from my change in apache24.

I have fixed mistake in www/apache24/options.mk, and now apache24 uses
event MPM. Previously apache24 is configured as classic prefork MPM by mistake.
When prefork MPM was used, thread problem is not occurred, because
apache24 does not support thread option.

So php modules do not work with multi thread apache24.
Potentially apache22 has same problem. It seems that apache22's default MPM is
prefork, but we can build apache22 with event/worker MPM.
Post by Greg Troxel
Is using a threaded MPM just the way apache24 is, or is this some sort
of configuration option?
I use apache24 with default options. So event MPM is used by default now.
Post by Greg Troxel
Post by Ryo ONODERA
PKG_OPTIONS=maintainer-zts (CONFIGURE_ARGS+=--enable-maintainer-zts) for
php5* and ap-php helps this error.
But what else does it change? Is there some reason our php has been
compiled without the threads option before?
But I see that
/usr/pkg/bin/php
are linked with threads already (in php53), but apparently that's different.
php has link to libpthread even when it is built without ZTS.
But apache24 thinks php module is not ready for multi threading.
Post by Greg Troxel
I tried to build php53 with that option, and the build failed.
It seem that php53 with ZTS support is broken and I cannot build it too.
I have no idea how to fix php53.
Post by Greg Troxel
I'd like to hear comments from other php/apache users/experts, too.
Yes.

--
Ryo ONODERA // ***@yk.rim.or.jp
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB FD1B F404 27FA C7D1 15F3
Takahiro Kambe
2014-03-25 16:31:39 UTC
Permalink
Hi,

In message <***@yk.rim.or.jp>
on Mon, 17 Mar 2014 23:51:03 +0900 (JST),
Post by Ryo ONODERA
Post by Greg Troxel
Post by Ryo ONODERA
[Mon Mar 17 20:49:54.145101 2014] [:crit] [pid 19026:tid 140187728347136] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.
AH00013: Pre-configuration failed
Is this new breakage, or have our php packages/modules always not worked
with apache24?
Oops. This breakage is caused from my change in apache24.
www/ap-php and some php modules are also broken on phgsrc-2013Q4
branch, it is too bad.

And effect of maintainer-zts should be consitent in all PHP and its
modules. So, how about disable maintainer-zts explicitly?

I'm not yet do runtime test, but it should fix unloadble php modules
in ap-php.
--
Takahiro Kambe <***@NetBSD.org>/<***@back-street.net>


Index: lang/php54/Makefile.php
===================================================================
RCS file: /cvsroot/pkgsrc/lang/php54/Makefile.php,v
retrieving revision 1.6
diff -u -u -r1.6 Makefile.php
--- lang/php54/Makefile.php 21 Jul 2013 17:29:47 -0000 1.6
+++ lang/php54/Makefile.php 25 Mar 2014 16:26:46 -0000
@@ -72,7 +72,9 @@
CONFIGURE_ARGS+= --without-openssl
.endif

-.if !empty(PKG_OPTIONS:Mmaintainer-zts)
+.if empty(PKG_OPTIONS:Mmaintainer-zts)
+CONFIGURE_ARGS+= --disable-maintainer-zts
+.else
CONFIGURE_ARGS+= --enable-maintainer-zts
.endif
matthew sporleder
2014-03-26 01:59:55 UTC
Permalink
Post by Takahiro Kambe
Hi,
on Mon, 17 Mar 2014 23:51:03 +0900 (JST),
Post by Ryo ONODERA
Post by Greg Troxel
Post by Ryo ONODERA
[Mon Mar 17 20:49:54.145101 2014] [:crit] [pid 19026:tid 140187728347136] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.
AH00013: Pre-configuration failed
Is this new breakage, or have our php packages/modules always not worked
with apache24?
Oops. This breakage is caused from my change in apache24.
www/ap-php and some php modules are also broken on phgsrc-2013Q4
branch, it is too bad.
And effect of maintainer-zts should be consitent in all PHP and its
modules. So, how about disable maintainer-zts explicitly?
I'm not yet do runtime test, but it should fix unloadble php modules
in ap-php.
--
Index: lang/php54/Makefile.php
===================================================================
RCS file: /cvsroot/pkgsrc/lang/php54/Makefile.php,v
retrieving revision 1.6
diff -u -u -r1.6 Makefile.php
--- lang/php54/Makefile.php 21 Jul 2013 17:29:47 -0000 1.6
+++ lang/php54/Makefile.php 25 Mar 2014 16:26:46 -0000
@@ -72,7 +72,9 @@
CONFIGURE_ARGS+= --without-openssl
.endif
-.if !empty(PKG_OPTIONS:Mmaintainer-zts)
+.if empty(PKG_OPTIONS:Mmaintainer-zts)
+CONFIGURE_ARGS+= --disable-maintainer-zts
+.else
CONFIGURE_ARGS+= --enable-maintainer-zts
.endif
This disabled zts by default, right?
Takahiro Kambe
2014-03-26 04:29:58 UTC
Permalink
In message <CAHKF-AtLKMZmk_1k-s2C5S1FU7Xmkt8sBin+vCt8-***@mail.gmail.com>
on Tue, 25 Mar 2014 21:59:55 -0400,
Post by matthew sporleder
Post by Takahiro Kambe
Index: lang/php54/Makefile.php
===================================================================
RCS file: /cvsroot/pkgsrc/lang/php54/Makefile.php,v
retrieving revision 1.6
diff -u -u -r1.6 Makefile.php
--- lang/php54/Makefile.php 21 Jul 2013 17:29:47 -0000 1.6
+++ lang/php54/Makefile.php 25 Mar 2014 16:26:46 -0000
@@ -72,7 +72,9 @@
CONFIGURE_ARGS+= --without-openssl
.endif
-.if !empty(PKG_OPTIONS:Mmaintainer-zts)
+.if empty(PKG_OPTIONS:Mmaintainer-zts)
+CONFIGURE_ARGS+= --disable-maintainer-zts
+.else
CONFIGURE_ARGS+= --enable-maintainer-zts
.endif
I have expected to --disable-maintainer-zts disable "-DZTS" in CFLAGS,
but sadly configure script dosen't honor it and it is enabled in
www/ap-php depending on version of Apache. :-(
Post by matthew sporleder
This disabled zts by default, right?
Yes. And if it is really required, maintainer-zts should be enabled
whole PHP packages by some method.
--
Takahiro Kambe <***@back-street.net>
matthew sporleder
2014-06-04 15:43:40 UTC
Permalink
Post by Takahiro Kambe
on Tue, 25 Mar 2014 21:59:55 -0400,
Post by matthew sporleder
Post by Takahiro Kambe
Index: lang/php54/Makefile.php
===================================================================
RCS file: /cvsroot/pkgsrc/lang/php54/Makefile.php,v
retrieving revision 1.6
diff -u -u -r1.6 Makefile.php
--- lang/php54/Makefile.php 21 Jul 2013 17:29:47 -0000 1.6
+++ lang/php54/Makefile.php 25 Mar 2014 16:26:46 -0000
@@ -72,7 +72,9 @@
CONFIGURE_ARGS+= --without-openssl
.endif
-.if !empty(PKG_OPTIONS:Mmaintainer-zts)
+.if empty(PKG_OPTIONS:Mmaintainer-zts)
+CONFIGURE_ARGS+= --disable-maintainer-zts
+.else
CONFIGURE_ARGS+= --enable-maintainer-zts
.endif
I have expected to --disable-maintainer-zts disable "-DZTS" in CFLAGS,
but sadly configure script dosen't honor it and it is enabled in
www/ap-php depending on version of Apache. :-(
Post by matthew sporleder
This disabled zts by default, right?
Yes. And if it is really required, maintainer-zts should be enabled
whole PHP packages by some method.
As of now, this is still unfixed, and it went into 2014Q1. I intend to fix this by disabling the part in PHP's configure that calls onto `httpd -V` to see if a threaded MPM is select - this is what really bakes ZTS into www/ap-php regardless of whether you pass --enable-maintainer-zts or not. That way hopefully we should have consistent PHP stack again, that's entirely controlled by the zfs-maintainer option.
-F
Since apache 2.4 it's possible to dynamically load an mpm instead of
only having one compiled in.

Is there a pkg-config system for all of this?
Filip Hajny
2014-06-04 16:00:51 UTC
Permalink
Post by matthew sporleder
Post by Takahiro Kambe
on Tue, 25 Mar 2014 21:59:55 -0400,
Post by matthew sporleder
Post by Takahiro Kambe
Index: lang/php54/Makefile.php
===================================================================
RCS file: /cvsroot/pkgsrc/lang/php54/Makefile.php,v
retrieving revision 1.6
diff -u -u -r1.6 Makefile.php
--- lang/php54/Makefile.php 21 Jul 2013 17:29:47 -0000 1.6
+++ lang/php54/Makefile.php 25 Mar 2014 16:26:46 -0000
@@ -72,7 +72,9 @@
CONFIGURE_ARGS+= --without-openssl
.endif
-.if !empty(PKG_OPTIONS:Mmaintainer-zts)
+.if empty(PKG_OPTIONS:Mmaintainer-zts)
+CONFIGURE_ARGS+= --disable-maintainer-zts
+.else
CONFIGURE_ARGS+= --enable-maintainer-zts
.endif
I have expected to --disable-maintainer-zts disable "-DZTS" in CFLAGS,
but sadly configure script dosen't honor it and it is enabled in
www/ap-php depending on version of Apache. :-(
Post by matthew sporleder
This disabled zts by default, right?
Yes. And if it is really required, maintainer-zts should be enabled
whole PHP packages by some method.
As of now, this is still unfixed, and it went into 2014Q1. I intend to fix this by disabling the part in PHP's configure that calls onto `httpd -V` to see if a threaded MPM is select - this is what really bakes ZTS into www/ap-php regardless of whether you pass --enable-maintainer-zts or not. That way hopefully we should have consistent PHP stack again, that's entirely controlled by the zfs-maintainer option.
-F
Since apache 2.4 it's possible to dynamically load an mpm instead of
only having one compiled in.
Exactly. And yet in the case of www/ap-php PHP’s configure determines ZTS based on the effective MPM in httpd.conf on the build machine, and not via --enable-zts-maintainer. That’s the ‘bug’.

-F
Filip Hajny
2014-06-04 15:13:46 UTC
Permalink
Post by Takahiro Kambe
on Tue, 25 Mar 2014 21:59:55 -0400,
Post by matthew sporleder
Post by Takahiro Kambe
Index: lang/php54/Makefile.php
===================================================================
RCS file: /cvsroot/pkgsrc/lang/php54/Makefile.php,v
retrieving revision 1.6
diff -u -u -r1.6 Makefile.php
--- lang/php54/Makefile.php 21 Jul 2013 17:29:47 -0000 1.6
+++ lang/php54/Makefile.php 25 Mar 2014 16:26:46 -0000
@@ -72,7 +72,9 @@
CONFIGURE_ARGS+= --without-openssl
.endif
-.if !empty(PKG_OPTIONS:Mmaintainer-zts)
+.if empty(PKG_OPTIONS:Mmaintainer-zts)
+CONFIGURE_ARGS+= --disable-maintainer-zts
+.else
CONFIGURE_ARGS+= --enable-maintainer-zts
.endif
I have expected to --disable-maintainer-zts disable "-DZTS" in CFLAGS,
but sadly configure script dosen't honor it and it is enabled in
www/ap-php depending on version of Apache. :-(
Post by matthew sporleder
This disabled zts by default, right?
Yes. And if it is really required, maintainer-zts should be enabled
whole PHP packages by some method.
As of now, this is still unfixed, and it went into 2014Q1. I intend to fix this by disabling the part in PHP’s configure that calls onto `httpd -V` to see if a threaded MPM is select - this is what really bakes ZTS into www/ap-php regardless of whether you pass --enable-maintainer-zts or not. That way hopefully we should have consistent PHP stack again, that’s entirely controlled by the zfs-maintainer option.

-F
Takahiro Kambe
2014-06-05 00:45:05 UTC
Permalink
Just FYI.

In message <84328616-6A7C-4719-A15B-***@joyent.com>
on Wed, 4 Jun 2014 17:13:46 +0200,
Post by Takahiro Kambe
Post by matthew sporleder
This disabled zts by default, right?
Yes. And if it is really required, maintainer-zts should be enabled
whole PHP packages by some method.
As of now, this is still unfixed, and it went into 2014Q1. I intend
My recent commit fixed possible inconsistent setting of PKG_OPTIONS
amaong php packages such as php54 and ap-php.
--
Takahiro Kambe <***@back-street.net>
Loading...