PHP 7 interview question · Most asked
What is the difference between running PHP as mod_php and PHP-FPM?
Summary
mod_php embeds PHP inside every Apache process, while PHP-FPM is a separate FastCGI process manager that web servers like Nginx or Apache (mod_proxy_fcgi) talk to.
Longer Answer
With mod_php, every Apache worker carries PHP's memory even when serving static files, and it requires the prefork MPM. FPM separates concerns: Nginx serves static files efficiently, and FPM pools can run under different users with independent limits, slow logs and status pages. FPM is the modern default.
Key Points
- mod_php: embedded, prefork only
- FPM: separate pools, better resource control
- Nginx + FPM is standard
More most-asked PHP 7 questions
- What are typed properties in PHP 7.4?
- How do return type declarations work in PHP 7?
- What were the headline improvements of PHP 7.0 over PHP 5.6?
- Explain scalar type declarations and coercive vs strict mode in PHP 7.
- Explain the `Throwable`, `Error` and `Exception` hierarchy introduced in PHP 7.
- What are nullable types in PHP 7.1?
- What does the null coalescing operator `??` do, and how is it different from `isset()` with a ternary?
- What are arrow functions in PHP 7.4 and how do they differ from closures?