Skip to content
Menu
DevSecOps Now!!!
  • About
  • Certifications
  • Contact
  • Courses
  • DevSecOps Consulting
  • DevSecOps Tools
  • Training
  • Tutorials
DevSecOps Now!!!

Convert XAMPP Apache to Event MPM + System PHP-FPM

Posted on March 11, 2026

Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

This setup keeps Apache from XAMPP and uses PHP-FPM from the OS. XAMPP’s main Apache config files on Linux are typically /opt/lampp/etc/httpd.conf and /opt/lampp/etc/extra/httpd-xampp.conf. Apache’s event MPM is built to serve more requests simultaneously, and PHP-FPM is PHP’s FastCGI process manager. To connect Apache to PHP-FPM, Apache needs mod_proxy and mod_proxy_fcgi. (apachefriends.org)

What we are doing

Before, Apache was likely using:

  • Prefork MPM
  • mod_php

After this change, Apache will use:

  • Event MPM
  • PHP-FPM through FastCGI

This is a common pattern because Apache event MPM is designed to free worker threads faster, while PHP-FPM runs PHP in a separate managed worker pool. (Apache HTTP Server)


Before you start

Run these commands first:

cp /opt/lampp/etc/httpd.conf /opt/lampp/etc/httpd.conf.bak
cp /opt/lampp/etc/extra/httpd-xampp.conf /opt/lampp/etc/extra/httpd-xampp.conf.bak

Also check your current Apache version and loaded MPM:

/opt/lampp/bin/httpd -V
/opt/lampp/bin/httpd -M | grep mpm

This gives you a rollback point before any change. XAMPP documents these Apache config paths for Linux, so these are the right files to protect first. (apachefriends.org)


Step 1: Install PHP-FPM

Run:

apt update
apt install php8.2-fpm

Verify:

php-fpm8.2 -v

PHP-FPM is PHP’s FastCGI Process Manager and is intended to run PHP as a separate service with its own process management. (PHP)


Step 2: Start and enable PHP-FPM

Run:

systemctl start php8.2-fpm
systemctl enable php8.2-fpm
systemctl status php8.2-fpm --no-pager

If the service is active, PHP-FPM is ready to accept requests from Apache. PHP-FPM supports managed worker pools and graceful process control, which is one reason it is preferred for heavier workloads. (PHP)


Step 3: Find the PHP-FPM socket

Run:

ls -l /run/php/

You will usually see something like:

php8.2-fpm.sock

If you do not see it, run:

grep -R "^listen =" /etc/php/8.2/fpm/pool.d/

Use the value shown there as your socket path.

This socket is the local communication channel Apache will use to pass .php requests to PHP-FPM. PHP-FPM pool files define how workers listen and operate. (PHP)


Step 4: Stop XAMPP before editing Apache config

Run:

/opt/lampp/lampp stop

Editing while Apache is stopped reduces confusion and avoids partial reload issues.


Step 5: Disable XAMPP’s built-in PHP module

Open the XAMPP config files and search for PHP-related lines:

grep -nE "php_module|x-httpd-php|AddType.*php" /opt/lampp/etc/httpd.conf /opt/lampp/etc/extra/httpd-xampp.conf

Then edit the file where those lines exist:

nano /opt/lampp/etc/httpd.conf
nano /opt/lampp/etc/extra/httpd-xampp.conf

Comment lines like these if you find them:

#LoadModule php_module modules/libphp.so
#AddType application/x-httpd-php .php

Why this step matters: if Apache still loads mod_php, then PHP is being handled inside Apache itself, which defeats the goal of moving PHP handling to PHP-FPM. Apache prefork is commonly used when non-thread-safe components require it; moving PHP out to FPM is exactly what allows event MPM to make sense. (Apache HTTP Server)


Step 6: Switch Apache from Prefork to Event MPM

Open:

nano /opt/lampp/etc/httpd.conf

Find:

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

Comment it:

#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

Now make sure this line is enabled:

LoadModule mpm_event_module modules/mod_mpm_event.so

If it is commented, remove the #.

Apache documents that the event MPM is designed to serve more simultaneous requests by offloading some connection-handling work, while prefork is a non-threaded pre-forking model. (Apache HTTP Server)


Step 7: Enable the modules Apache needs for FastCGI

In the same httpd.conf, make sure these lines are enabled:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
LoadModule setenvif_module modules/mod_setenvif.so

Apache’s mod_proxy_fcgi requires mod_proxy, and these modules are what let Apache forward PHP requests to PHP-FPM. (Apache HTTP Server)


Step 8: Tell Apache to send .php files to PHP-FPM

At the bottom of httpd.conf, add this:

<FilesMatch \.php$>
    SetHandler "proxy:unix:/run/php/php8.2-fpm.sock|fcgi://localhost/"
</FilesMatch>

If your socket path is different, use that path instead.

This tells Apache that whenever a .php file is requested, it should hand the request to PHP-FPM over FastCGI instead of trying to execute PHP internally. Apache’s FastCGI proxy module is specifically meant for that job. (Apache HTTP Server)


Step 9: Test Apache config before restart

Run:

/opt/lampp/bin/httpd -t

You want to see:

Syntax OK

Do not restart anything until this passes.


Step 10: Start PHP-FPM and restart XAMPP

Run:

systemctl restart php8.2-fpm
/opt/lampp/lampp start

Then verify Apache is up:

ps aux | grep httpd

Step 11: Confirm Apache is using Event MPM

Run:

/opt/lampp/bin/httpd -V | grep "Server MPM"

Expected result:

Server MPM: event

Apache’s official docs describe event as the MPM intended to handle more simultaneous connections efficiently than prefork in appropriate environments. (Apache HTTP Server)


Step 12: Confirm PHP is running through FPM

Create a test file:

cat > /opt/lampp/htdocs/info.php <<'EOF'
<?php phpinfo();
EOF

Open in browser:

http://YOUR-SERVER-IP/info.php

Check this line on the page:

Server API: FPM/FastCGI

If you see that, Apache is no longer using mod_php for PHP execution.


Final request flow

After setup, the request flow becomes:

Browser → XAMPP Apache → mod_proxy_fcgi → PHP-FPM socket → PHP worker → Response

That separation is the key architectural improvement: Apache handles HTTP connections, and PHP-FPM handles PHP workers. (Apache HTTP Server)


Easy rollback plan

If anything breaks, do this:

cp /opt/lampp/etc/httpd.conf.bak /opt/lampp/etc/httpd.conf
cp /opt/lampp/etc/extra/httpd-xampp.conf.bak /opt/lampp/etc/extra/httpd-xampp.conf
systemctl restart php8.2-fpm
/opt/lampp/lampp restart

If needed, you can also stop PHP-FPM temporarily:

systemctl stop php8.2-fpm

Common issues and fixes

1. Apache does not start

Run:

/opt/lampp/bin/httpd -t

Usually this means:

  • wrong module line
  • duplicate MPM
  • wrong SetHandler socket path

2. 503 Service Unavailable

Usually PHP-FPM is not running or Apache is pointing to the wrong socket.

Check:

systemctl status php8.2-fpm --no-pager
ls -l /run/php/
grep -R "^listen =" /etc/php/8.2/fpm/pool.d/

3. PHP files download instead of execute

This usually means:

  • SetHandler block is missing
  • mod_proxy_fcgi is not loaded
  • Apache config was edited in the wrong file

Check:

/opt/lampp/bin/httpd -M | grep -E "proxy|fcgi|mpm"

4. Apache still shows Prefork

Check whether both MPMs are loaded accidentally:

grep -n "mpm_" /opt/lampp/etc/httpd.conf

Only one MPM should be enabled.


Team checklist

Your team can use this short checklist:

1. Backup XAMPP Apache config
2. Install php8.2-fpm
3. Start and enable php8.2-fpm
4. Find FPM socket path
5. Stop XAMPP
6. Disable mod_php
7. Enable event MPM
8. Enable proxy + proxy_fcgi
9. Add FilesMatch SetHandler for PHP-FPM
10. Run Apache config test
11. Restart php8.2-fpm and XAMPP
12. Verify:
   - Server MPM: event
   - Server API: FPM/FastCGI

Important note for your team

This setup is practical, but it is still a hybrid model: XAMPP Apache + system PHP-FPM. It works, but it is less standard than using a full OS-managed Apache + OS-managed PHP stack. Keep the config changes documented carefully so future team members know that Apache is coming from /opt/lampp while PHP-FPM is coming from the system packages. XAMPP itself documents the main config file locations, which is helpful for this mixed setup. (apachefriends.org)

Post Views: 434
  • apache
  • apache concurrency
  • apache event mpm
  • apache performance tuning
  • apache php architecture
  • apache proxy_fcgi
  • event mpm configuration
  • fastcgi setup
  • high performance php stack
  • linux server optimization
  • mod_php disable
  • php worker pool
  • php-fpm
  • php-fpm setup
  • php-fpm socket
  • Xampp
  • xampp apache optimization
  • xampp linux setup
  • xampp performance
Subscribe
Login
Notify of
guest
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
  • Master the Machine Learning Lifecycle:Guide to Becoming a Certified MLOps Architect
  • How to Build a Project-Level AI Memory System That Works Across Codex, Claude, and Other AI Coding Tools
  • Certified MLOps Professional: A Deep Dive into the Certified MLOps Professional Certification
  • Certified MLOps Engineer : The Comprehensive Guide to Mastering Machine Learning Operations
  • Codex vs Claude: A Complete Practical Guide for Modern Developers (2026)
  • Certified AIOps Professional Program A Guide to Career Growth
  • Keycloak Multi-Client Architecture with Project-Based Email Validation (Student, Trainer, Company, Consulting)
  • Incorrect definition of table mysql.column_stats
  • Mautic and PHP 8.3 Compatibility Guide (2026)
  • Certified AIOps Engineer: The Complete Career Path and Certification Guide
  • How to Rename Apache Virtual Host Files Safely (Step-by-Step Guide for Linux)
  • AIOps Foundation Certification: Everything You Need to Know to Get Certified
  • DevOps to Certified Site Reliability Professional: A Senior Mentor’s Guide
  • Certified Site Reliability Manager Training, Preparation, and Career Mapping
  • Certified Site Reliability Architect: The Complete Career Guide
  • What Is a VPN? A Complete Beginner-to-Advanced Tutorial
  • How to Install, Secure, and Tune MySQL 8.4 on Ubuntu 24.04 for Apache Event MPM and PHP-FPM
  • Complete Guide to Certified Site Reliability Engineer Career
  • Certified DevSecOps Professional Step by Step
  • Certified DevSecOps Manager: Complete Career Guide
  • Certified DevSecOps Engineer: Skills, Career Path and Certification Guide
  • Step-by-Step: Become a Certified DevSecOps Architect
  • Tuning PHP 8.3 for Apache Event MPM and PHP-FPM on Ubuntu: A Complete Step-by-Step Production Guide
  • Complete Step-by-Step Guide to Configure Apache Event MPM, Create index.php, Set Up VirtualHost, and Fix Ubuntu Default Page
  • Convert XAMPP Apache to Event MPM + System PHP-FPM
  • The Gateway to System Observability Engineering (MOE)
  • How to Finetune Apache and Prove It Works: A Real-World Guide to Testing Performance, Concurrency, HTTP/2, Memory, CPU, and Security
  • Building a High-Performance Apache Event MPM + PHP-FPM + MariaDB Stack (Advanced Server Optimization Guide)
  • Master Infrastructure as Code: The Complete Hashicorp Terraform Associate Guide
  • Building a High-Performance Apache Server with Event MPM + PHP-FPM (Step-by-Step Guide)

Recent Comments

  1. emmy day on SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘provider’ in ‘field list’
  2. digital banking on Complete Tutorial: Setting Up Laravel Telescope Correctly (Windows + XAMPP + Custom Domain)
  3. SAHIL DHINGRA on How to Uninstall Xampp from your machine when it is not visible in Control panel programs & Feature ?
  4. Abhishek on MySQL: List of Comprehensive List of approach to secure MySQL servers.
  5. Kristina on Best practices to followed in .httacess to avoid DDOS attack?

Archives

  • April 2026
  • March 2026
  • February 2026
  • January 2026
  • December 2025
  • November 2025
  • October 2025
  • September 2025
  • August 2025
  • July 2025
  • June 2025
  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • July 2024
  • June 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022

Categories

  • Ai
  • AI Blogging
  • AiOps
  • ajax
  • Android Studio
  • Antimalware
  • Antivirus
  • Apache
  • Api
  • API Security
  • Api Testing
  • APK
  • Aws
  • Bike Rental Services
  • ChatGPT
  • Code Linting
  • Composer
  • cPanel
  • Cyber Threat Intelligence
  • Cybersecurity
  • Data Loss Prevention
  • Database
  • dataops
  • Deception Technology
  • DeepSeek
  • Devops
  • DevSecOps
  • DevTools
  • Digital Asset Management
  • Digital Certificates
  • Docker
  • Drupal
  • emulator
  • Encryption Tools
  • Endpoint Security Tools
  • Error
  • facebook
  • Firewalls
  • Flutter
  • git
  • GITHUB
  • Google Antigravity
  • Google play console
  • Google reCAPTCHA
  • Gradle
  • Guest posting
  • health and fitness
  • IDE
  • Identity and Access Management
  • Incident Response
  • Instagram
  • Intrusion Detection and Prevention Systems
  • jobs
  • Joomla
  • Keycloak
  • Laravel
  • Law News
  • Lawyer Discussion
  • Legal Advice
  • Linkedin
  • Linkedin Api
  • Linux
  • Livewire
  • Mautic
  • Medical Tourism
  • MlOps
  • MobaXterm
  • Mobile Device Management
  • Multi-Factor Authentication
  • MySql
  • Network Traffic Analysis tools
  • Paytm
  • Penetration Testing
  • php
  • PHPMyAdmin
  • Pinterest Api
  • Quora
  • SAST
  • SecOps
  • Secure File Transfer Protocol
  • Security Analytics Tools
  • Security Auditing Tools
  • Security Information and Event Management
  • Seo
  • Server Management Tools
  • Single Sign-On
  • Site Reliability Engineering
  • soft 404
  • software
  • SuiteCRM
  • SysOps
  • Threat Model
  • Twitter
  • Twitter Api
  • ubuntu
  • Uncategorized
  • Virtual Host
  • Virtual Private Networks
  • VPNs
  • Vulnerability Assessment Tools
  • Web Application Firewalls
  • Windows Processor
  • Wordpress
  • WSL (Windows Subsystem for Linux)
  • X.com
  • Xampp
  • Youtube
©2026 DevSecOps Now!!! | WordPress Theme: EcoCoded
wpDiscuz