6

I read a lot of posts saying I should't use worker MPM with PHP.

My question is whether this is still valid or could it be that working with the worker MPM is not recommended.

The reason I ask this is because i saw that the worker MPM does support PHP and I think that there's even a package for that purpose called php-zts

Kuf
  • 449
  • 2
  • 8
  • 24

2 Answers2

3

It depends on what PHP extensions you are going to use. Not every 3rd party PHP module is guaranteed to be thread-safe, so I think the recommendation to use prefork MPM with PHP is still valid.

Alex
  • 7,789
  • 4
  • 36
  • 51
3

Last time I gave it a try (like 6-12 months ago?), I still had some really serious problems as apache would hang after a few hits on some virtualhosts. Coming back to prefork mpm solved my problem so I guess it was worker+php related and did not investigate any further.

Since this time, I heard that php fpm is now stable and merged in php codebase... You may want to try it with apache 2.4 but it is said that there are still non-thread-safe issues:

" As with the worker MPM of the previous version, the threaded model of this MPM causes issues when mod_php is used with non-thread-safe 3rd-party PHP extensions."

  • 1
    The issue you refer to deals with the old mod-php in Apache 2.4, not with PHP-FPM. It would be better to move to PHP-FPM in any case, I think. It doesn't have the threading issues of mod-php and moves the heavy PHP lifting out of each Apache process into separate PHP processes. Apache gets lighter, and PHP becomes more efficient. PHP-FPM also gives you the choice between Apache, Nginx or another webserver, without affecting PHP. You can even have multiple PHP 'pools' with different settings. FPM is the way to go. – Martijn Heemels Aug 09 '12 at 19:10
  • So I guess there is no more non-thread-safe issue once you run php-fpm? Anyone successfully runs medium/large production websites on phpfpm+webserver? php 5.3+ or php 5.4 or both? –  Aug 09 '12 at 20:59
  • 1
    I wish I could tell you from experience but we're still in the process of testing for 5.3. At a PHP conference I visited last February there was a lot of praise for PHP-FPM, including from some companies that I know run large sites. That's a rather indirect endorsement, but it was enough to get my company interested. – Martijn Heemels Sep 03 '12 at 14:47