Tips and tricks

Homebrew - Convert from Php Module to PHP-FPM

Is PHP-FPM better than mod_php ? Short answer…

Yes—PHP-FPM is the better choice for your stack (Homebrew Apache on macOS), mainly because it lets you run the event MPM (needed for HTTP/2 and better concurrency) while keeping PHP out of Apache’s memory space. mod_php ties you to prefork, which disables HTTP/2 and scales worse.

Below is a crisp comparison, then two complete, minimal configs: one “modern” with PHP-FPM (event, HTTP/2), and one “legacy” with mod_php (prefork).

PHP-FPM (via proxy_fcgi)

Pros

  • Works with mpm_event/worker → enables HTTP/2 and better concurrency.
  • Lower memory per connection (Apache threads don’t embed PHP).
  • Crash isolation: PHP crashes don’t take Apache with them.
  • Tunable pools per site (pm.*, slowlog, status/ping endpoints).
  • Easier upgrades (restart FPM without bouncing Apache).

Cons

  • One more hop (FastCGI). Overhead is tiny, but it exists.
  • You can’t use php_value / php_flag in .htaccess (use .user.ini or FPM pool).
mod_php

Pros

  • Simple “all-in-one” dev setup; php_value in .htaccess just works.

Cons

  • Forces mpm_prefork (no HTTP/2; worse concurrency).
  • Higher memory: every Apache child loads PHP.
  • PHP crash = Apache process crash.
  • Falling out of favor; most stacks moved to FPM years ago.

Check which module your server is running

cat > "/{{SERVER_LOCATION}}/info.php" <<'PHP' <?php phpinfo(); PHP 
curl -s -k https://{{SERVER_URI}}/info.php | grep -i 'Server API' 
rm "/{{SERVER_LOCATION}}/info.php"

If it says

<tr><td class="e">Server API </td><td class="v">FPM/FastCGI </td></tr> <tr><td class="e">Server API (SAPI) Abstraction Layer </td><td class="v">Andi Gutmans, Shane Caraveo, Zeev Suraski </td></tr>

Then, it’s Server API ⇒ FPM/FastCGI → your site is running PHP-FPM behind Apache (via proxy_fcgi), not mod_php.

Leave a comment

Your email address will not be published

{"type":"main_options","images_arr":"'#ffffff'","enable_ajax":"off","soundcloud_apikey":"","bg_isparallax":"off","bg_slideshow_time":"0","bg_transition":"none","site_url":"https:\/\/digitalzoomstudio.net","theme_url":"https:\/\/digitalzoomstudio.net\/wp-content\/themes\/qucreative\/","blur_ammount":"26","width_column":"50","width_section_bg":"","width_gap":"30","border_width":"0","border_color":"#ffffff","translate_cancel_comment":"Cancel reply","translate_leave_a_comment":"Leave a comment","translate_leave_a_comment_to":"Leave a comment to","is_customize_preview":"off","width_blur_margin":"30","gallery_w_thumbs_autoplay_videos":"off","content_enviroment_opacity":"30","menu_enviroment_opacity":"70","base_url":"https:\/\/digitalzoomstudio.net"}
{"type":"darkfull"}