<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>FPM - RandomBitsOnFire</title>
	<atom:link href="https://randombitsonfire.com/tag/fpm/feed/" rel="self" type="application/rss+xml" />
	<link>https://randombitsonfire.com</link>
	<description>Home</description>
	<lastBuildDate>Thu, 05 Mar 2026 09:04:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://randombitsonfire.com/wp-content/uploads/2024/08/cropped-favicon512x512-32x32.png</url>
	<title>FPM - RandomBitsOnFire</title>
	<link>https://randombitsonfire.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>PHP y PHP-FPM con Apache: diferencias</title>
		<link>https://randombitsonfire.com/programacion/back/php-y-php-fpm-con-apache-diferencias/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-y-php-fpm-con-apache-diferencias</link>
					<comments>https://randombitsonfire.com/programacion/back/php-y-php-fpm-con-apache-diferencias/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 09 Mar 2026 11:00:00 +0000</pubDate>
				<category><![CDATA[Arquitectura]]></category>
		<category><![CDATA[Back]]></category>
		<category><![CDATA[Programacion]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[FPM]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Servidores]]></category>
		<category><![CDATA[Web]]></category>
		<guid isPermaLink="false">https://randombitsonfire.com/?p=144</guid>

					<description><![CDATA[<p>Si estás desarrollando aplicaciones web con PHP, seguramente te habrás encontrado con distintos métodos para ejecutar el código: mod_php, PHP-FPM, y cómo Apache los maneja. Vamos a desglosarlo. 1. PHP tradicional con Apache (mod_php) 2. PHP-FPM (FastCGI Process Manager) Requiere monitoreo de los pools de procesos para evitar saturación. Qué es: PHP-FPM es un gestor [&#8230;]</p>
<p>The post <a href="https://randombitsonfire.com/programacion/back/php-y-php-fpm-con-apache-diferencias/">PHP y PHP-FPM con Apache: diferencias</a> first appeared on <a href="https://randombitsonfire.com">RandomBitsOnFire</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Si estás desarrollando aplicaciones web con <strong>PHP</strong>, seguramente te habrás encontrado con distintos métodos para ejecutar el código: <strong>mod_php</strong>, <strong>PHP-FPM</strong>, y cómo Apache los maneja. Vamos a desglosarlo.</p>



<h3 class="wp-block-heading">1. PHP tradicional con Apache (mod_php)</h3>



<ul class="wp-block-list">
<li><strong>Qué es:</strong> <code>mod_php</code> es un módulo de Apache que permite ejecutar código PHP directamente dentro del proceso del servidor web.</li>



<li><strong>Cómo funciona:</strong> Apache carga el intérprete de PHP como parte de sus procesos. Cada petición HTTP que requiere PHP es procesada dentro del mismo proceso de Apache.</li>



<li><strong>Ventajas:</strong>
<ul class="wp-block-list">
<li>Simplicidad: fácil de configurar.</li>



<li>Integración directa: PHP puede acceder a variables de Apache y módulos internos.</li>
</ul>
</li>



<li><strong>Desventajas:</strong>
<ul class="wp-block-list">
<li>Cada proceso de Apache carga PHP completo, lo que aumenta el consumo de memoria.</li>



<li>No es tan eficiente en entornos con muchas conexiones concurrentes.</li>
</ul>
</li>
</ul>



<figure class="wp-block-image aligncenter size-full"><img fetchpriority="high" decoding="async" width="459" height="292" src="https://randombitsonfire.com/wp-content/uploads/2026/02/image-1.png" alt="" class="wp-image-218" srcset="https://randombitsonfire.com/wp-content/uploads/2026/02/image-1.png 459w, https://randombitsonfire.com/wp-content/uploads/2026/02/image-1-300x191.png 300w" sizes="(max-width: 459px) 100vw, 459px" /></figure>



<h3 class="wp-block-heading">2. PHP-FPM (FastCGI Process Manager)</h3>



<p>Requiere monitoreo de los pools de procesos para evitar saturación.</p>



<p><strong>Qué es:</strong> PHP-FPM es un gestor de procesos FastCGI para PHP. Funciona como un servicio independiente que Apache llama para ejecutar scripts PHP.</p>



<p><strong>Cómo funciona:</strong></p>



<p>Apache recibe la petición HTTP.</p>



<p>Si es un archivo PHP, Apache lo redirige a PHP-FPM mediante <strong>FastCGI</strong> (usualmente usando <code>mod_proxy_fcgi</code>). <strong>En versiones de Linux Alpine se encuentra incluido en el mod_proxy</strong>.</p>



<p>PHP-FPM procesa el script y devuelve la respuesta a Apache.</p>



<p><strong>Ventajas:</strong></p>



<p>Manejo eficiente de procesos: PHP-FPM mantiene pools de procesos listos para servir solicitudes.</p>



<p>Mejor rendimiento en sitios con alta concurrencia.</p>



<p>Permite ejecutar diferentes versiones de PHP para distintos sitios.</p>



<p>Mejor aislamiento de procesos y control de recursos.</p>



<p><strong>Desventajas:</strong></p>



<p>Configuración más compleja.</p>



<figure class="wp-block-image aligncenter size-full"><img decoding="async" width="562" height="319" src="https://randombitsonfire.com/wp-content/uploads/2026/02/image-2.png" alt="" class="wp-image-219" srcset="https://randombitsonfire.com/wp-content/uploads/2026/02/image-2.png 562w, https://randombitsonfire.com/wp-content/uploads/2026/02/image-2-300x170.png 300w" sizes="(max-width: 562px) 100vw, 562px" /></figure>



<h3 class="wp-block-heading">3. Cómo Apache gestiona PHP con FPM</h3>



<p>Apache ya no ejecuta PHP directamente. Usa <strong>mod_proxy_fcgi</strong> o <strong>mod_fastcgi</strong> para comunicarse con PHP-FPM:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:clamp(12px, .75rem, 18px);font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(16px, 1rem, 24px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" style="color:#d8dee9ff;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>&lt;FilesMatch .php$>
    SetHandler "proxy:unix:/run/php/php8.1-fpm.sock|fcgi://localhost/"
&lt;/FilesMatch></textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki nord" style="background-color: #2e3440ff" tabindex="0"><code><span class="line"><span style="color: #81A1C1">&lt;</span><span style="color: #D8DEE9FF">FilesMatch </span><span style="color: #ECEFF4">.</span><span style="color: #D8DEE9">php$</span><span style="color: #81A1C1">&gt;</span></span>
<span class="line"><span style="color: #D8DEE9FF">    SetHandler </span><span style="color: #ECEFF4">&quot;</span><span style="color: #A3BE8C">proxy:unix:/run/php/php8.1-fpm.sock|fcgi://localhost/</span><span style="color: #ECEFF4">&quot;</span></span>
<span class="line"><span style="color: #81A1C1">&lt;/</span><span style="color: #D8DEE9FF">FilesMatch</span><span style="color: #81A1C1">&gt;</span></span></code></pre></div>



<ul class="wp-block-list">
<li><code>SetHandler</code> indica que las peticiones PHP se deben enviar a PHP-FPM.</li>



<li>PHP-FPM escucha en un <strong>socket Unix</strong> o <strong>puerto TCP</strong> y devuelve la salida ya procesada.</li>



<li>Apache sigue manejando la conexión HTTP, logging, seguridad y otras funcionalidades, pero la ejecución de PHP queda delegada.</li>
</ul>



<h3 class="wp-block-heading">4. Resumen de diferencias</h3>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th>Característica</th><th>mod_php (tradicional)</th><th>PHP-FPM (FastCGI)</th></tr></thead><tbody><tr><td>Ejecución</td><td>Dentro de Apache</td><td>Servicio externo</td></tr><tr><td>Rendimiento</td><td>Bueno en bajo tráfico</td><td>Mejor en alto tráfico</td></tr><tr><td>Memoria</td><td>Alta</td><td>Optimizada</td></tr><tr><td>Multiples versiones</td><td>Difícil</td><td>Fácil</td></tr><tr><td>Aislamiento</td><td>Bajo</td><td>Alto</td></tr></tbody></table></figure>



<h3 class="wp-block-heading">5. Conclusión</h3>



<ul class="wp-block-list">
<li><strong>mod_php</strong> es más simple y suficiente para sitios pequeños o entornos de desarrollo.</li>



<li><strong>PHP-FPM</strong> es más eficiente, flexible y escalable, ideal para producción y sitios con alta carga.</li>



<li>Apache gestiona la parte HTTP y delega la ejecución de PHP a PHP-FPM, optimizando recursos y manteniendo la seguridad y control.</li>
</ul>



<h3 class="wp-block-heading">5. Exclusividad de PHP-FPM y orden de ejecución con Apache</h3>



<p>Cuando usamos <strong>PHP-FPM</strong>, Apache ya <strong>no ejecuta PHP directamente</strong>. Esto implica dos cosas importantes:</p>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th>Nombre en paquete</th><th>Qué incluye</th></tr></thead><tbody><tr><td>php-apache</td><td>PHP + mod_php</td></tr><tr><td>php-fpm</td><td>PHP + FPM</td></tr></tbody></table></figure>



<h4 class="wp-block-heading">1&#xfe0f;&#x20e3; Exclusividad de PHP-FPM</h4>



<ul class="wp-block-list">
<li><strong>Solo puede haber un intérprete activo por socket o puerto</strong>.</li>



<li>PHP-FPM actúa como un <strong>servicio independiente</strong>, gestionando un <strong>pool de procesos</strong> que reciben solicitudes de PHP de Apache (o Nginx).</li>



<li>Si tienes múltiples instancias de PHP-FPM escuchando en el mismo socket, habrá conflictos.</li>



<li>Por eso se habla de <strong>“exclusividad”</strong>: cada pool de PHP-FPM se asigna a un <strong>sitio o versión de PHP</strong> y Apache lo llama a través del socket/puerto definido.</li>
</ul>



<h2 class="wp-block-heading">6. Ejecución del servidor</h2>



<h3 class="wp-block-heading">1&#xfe0f;&#x20e3; Arranque con <strong>mod_php (php-apache)</strong> en Alpine</h3>



<p>En Alpine, normalmente instalas el paquete <code>php-apache2</code>:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:clamp(12px, .75rem, 18px);font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(16px, 1rem, 24px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" style="color:#d8dee9ff;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly># Instalar Apache + mod_php
apk add apache2 php8-apache2

# Iniciar Apache (que ya carga PHP internamente)
httpd -D</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki nord" style="background-color: #2e3440ff" tabindex="0"><code><span class="line"><span style="color: #D8DEE9FF"># </span><span style="color: #8FBCBB">Instalar</span><span style="color: #D8DEE9FF"> Apache </span><span style="color: #81A1C1">+</span><span style="color: #D8DEE9FF"> mod_php</span></span>
<span class="line"><span style="color: #D8DEE9FF">apk add apache2 php8</span><span style="color: #81A1C1">-</span><span style="color: #D8DEE9FF">apache2</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D8DEE9FF"># </span><span style="color: #8FBCBB">Iniciar</span><span style="color: #D8DEE9FF"> </span><span style="color: #88C0D0">Apache</span><span style="color: #D8DEE9FF"> </span><span style="color: #ECEFF4">(</span><span style="color: #D8DEE9FF">que ya carga </span><span style="color: #8FBCBB">PHP</span><span style="color: #D8DEE9FF"> internamente</span><span style="color: #ECEFF4">)</span></span>
<span class="line"><span style="color: #D8DEE9FF">httpd </span><span style="color: #81A1C1">-</span><span style="color: #8FBCBB">D</span></span></code></pre></div>



<ul class="wp-block-list">
<li><strong>Nota:</strong> No hay servicio PHP externo, todo corre dentro de Apache.</li>
</ul>



<h3 class="wp-block-heading">2&#xfe0f;&#x20e3; Arranque con <strong>PHP-FPM + Apache</strong> en Alpine</h3>



<p>Instalas PHP-FPM y Apache, y configuras Apache para usar FastCGI:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:clamp(12px, .75rem, 18px);font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(16px, 1rem, 24px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" style="color:#d8dee9ff;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly># Instalar PHP-FPM y Apache
apk add php8-fpm php8-opcache apache2

# Hablitar modulo proxy o proxy_fcgi segun se necesite
...
# Agregar configuracion proxy a FCGI
...

# Iniciar FPM 
php-fpm8 

# Iniciar Apache 
httpd -D
</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki nord" style="background-color: #2e3440ff" tabindex="0"><code><span class="line"><span style="color: #D8DEE9FF"># </span><span style="color: #8FBCBB">Instalar</span><span style="color: #D8DEE9FF"> PHP</span><span style="color: #81A1C1">-</span><span style="color: #8FBCBB">FPM</span><span style="color: #D8DEE9FF"> y </span><span style="color: #8FBCBB">Apache</span></span>
<span class="line"><span style="color: #D8DEE9FF">apk add php8</span><span style="color: #81A1C1">-</span><span style="color: #D8DEE9FF">fpm php8</span><span style="color: #81A1C1">-</span><span style="color: #D8DEE9FF">opcache apache2</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D8DEE9FF"># </span><span style="color: #8FBCBB">Hablitar</span><span style="color: #D8DEE9FF"> modulo proxy o proxy_fcgi segun se necesite</span></span>
<span class="line"><span style="color: #ECEFF4">...</span></span>
<span class="line"><span style="color: #D8DEE9FF"># </span><span style="color: #8FBCBB">Agregar</span><span style="color: #D8DEE9FF"> configuracion proxy a </span><span style="color: #8FBCBB">FCGI</span></span>
<span class="line"><span style="color: #ECEFF4">...</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D8DEE9FF"># </span><span style="color: #8FBCBB">Iniciar</span><span style="color: #D8DEE9FF"> </span><span style="color: #8FBCBB">FPM</span><span style="color: #D8DEE9FF"> </span></span>
<span class="line"><span style="color: #D8DEE9FF">php</span><span style="color: #81A1C1">-</span><span style="color: #D8DEE9FF">fpm8 </span></span>
<span class="line"></span>
<span class="line"><span style="color: #D8DEE9FF"># </span><span style="color: #8FBCBB">Iniciar</span><span style="color: #D8DEE9FF"> </span><span style="color: #8FBCBB">Apache</span><span style="color: #D8DEE9FF"> </span></span>
<span class="line"><span style="color: #D8DEE9FF">httpd </span><span style="color: #81A1C1">-</span><span style="color: #8FBCBB">D</span></span>
<span class="line"></span></code></pre></div><p>The post <a href="https://randombitsonfire.com/programacion/back/php-y-php-fpm-con-apache-diferencias/">PHP y PHP-FPM con Apache: diferencias</a> first appeared on <a href="https://randombitsonfire.com">RandomBitsOnFire</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://randombitsonfire.com/programacion/back/php-y-php-fpm-con-apache-diferencias/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
