FS#39218 - [php] Enable thread safety

Attached to Project: Arch Linux
Opened by Ľubomír Kučera (Kuci) - Friday, 07 March 2014, 20:05 GMT
Last edited by Anatol Pomozov (anatolik) - Tuesday, 11 March 2014, 19:44 GMT
Task Type Feature Request
Category Packages: Extra
Status Closed
Assigned To Pierre Schmitz (Pierre)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 3
Private No

Details

With the latest Apache 2.4.7, PHP and its extensions need to be compiled with thread safety enabled. Otherwise, Apache will not start.

To enable thread safety use '--enable-maintainer-zts' parameter.
This task depends upon

Closed by  Anatol Pomozov (anatolik)
Tuesday, 11 March 2014, 19:44 GMT
Reason for closing:  Won't fix
Additional comments about closing:  Users should use thread-safe MPM instead.
Comment by Doug Newgard (Scimmia) - Friday, 07 March 2014, 20:37 GMT
Probably a duplicate of  FS#39107  and  FS#39214 .
Comment by Anatol Pomozov (anatolik) - Friday, 07 March 2014, 20:54 GMT Comment by Anatol Pomozov (anatolik) - Friday, 07 March 2014, 20:57 GMT
It might be a good idea to add a message to the package post_install() saying that

"By default Apache uses thread-safe MPM engine, but PHP compiled without it. To use provided php module change

LoadModule mpm_event_module modules/mod_mpm_event.so
to
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so"

BTW why mod_php was compiled without thread-safety? Is it security/stability issue?
Comment by Jan de Groot (JGC) - Saturday, 08 March 2014, 17:57 GMT
It adds overhead for something that doesn't guarantee thread safety due to 3rd party libs.
If you want mod-php, use prefork. If you want the advantages of worker or event mpm, you're not looking at mod-php anyways.
Comment by Sebastiaan Lokhorst (lonaowna) - Sunday, 09 March 2014, 10:14 GMT
If we're against thread-safety, can't we supply a default httpd.conf in the apache package, with mod_mpm_prefork.so enabled by default? So we're consistent and people don't have to manually change it. It seems strange to ship one package with thread-safety explicitly enabled, and another one with it explicitly disabled.

Edit: I'm sorry, JGC in the comment above me is right. If you use mod-php, you should use mpm_prefork. For most other Apache plugins, you should use mpm_event.
I think anatolik's post_install suggestion would be very useful.
Comment by GI Jack (GI_Jack) - Monday, 10 March 2014, 02:20 GMT
confirmed, affected me too

edit: we need to post something on the frontpage blog about this, because this has been breaking people's setups, and Apache + PHP is a pretty default option.
Comment by Jan de Groot (JGC) - Monday, 10 March 2014, 08:31 GMT
The upstream default for apache is using mpm_event. We won't switch the default MPM to prefork for just PHP. There is use for mod_php (you have a webserver processing pure PHP stuff with something like varnish in the front to cache static files), but recommended way of using PHP is mod_fastcgi+php-fpm or mod_fcgid+suexec in shared hosting environments.

This should be documented in the wiki, adding post_install messages won't solve anything because nobody reads those when they're installing more than just PHP.
Comment by D. Casey Tucker (dctucker) - Monday, 10 March 2014, 15:29 GMT
Here's the thing: There are quite a few applications out there running standard mod_php on top of Apache.

I fully agree, this should be documented in the wiki, however, this configuration may not be suitable for all use cases.
Comment by Anatol Pomozov (anatolik) - Monday, 10 March 2014, 17:49 GMT
We should stick with the default MPM mod_mpm_event - it is more scalable and faster MPM and most users will take advantage of using it. The problem is not mpm_event but the fact that the default MPM is not compatible with mod_php. And users have to switch mpm if they want to use PHP.

jgc: although there are users who does not read installation message there are users who does it (and *should* read it). I believe that this mod_php issue will be a source of questions for a long time. And to avoid questions we need to add good documentation. wiki, arch news, install messages all these are documentation that will be helpful to users.

Pierre, I would like to add a post_install() message to php-apache module. Let me know if you have objections.
Comment by Anatol Pomozov (anatolik) - Tuesday, 11 March 2014, 19:43 GMT
Ok, we want to keep the defaults as is. Apache will use mpm_event by default, and mod_php will be compiled without thread-safe support.

Part of the problem is that mod_php error message "Apache is running a threaded MPM, but your PHP Module is not
compiled to be threadsafe. You need to recompile PHP." is too confusing. It suggests binaries recompilation which is not the best solution. The error message should be "Apache is running a threaded MPM, but your PHP Module is not
compiled to be threadsafe. Either change MPM to thread-safe one (mpm_prefork) or recompile PHP with --enable-maintainer-zts flag". My point is that the error message should recommend changing MPM as a first solution. Please contact PHP upstream.
Comment by Anatol Pomozov (anatolik) - Tuesday, 11 March 2014, 19:43 GMT
It is also well documented in wiki https://wiki.archlinux.org/index.php/LAMP#PHP

Loading...