Apache's "execution model" is two decisions working together: how Apache itself handles connections (its Multi-Processing Module, or MPM) and how it runs your code, such as PHP, under which user. Those two choices decide how many visitors a server can handle, how much memory it needs and whether one site on the server can read another's files. This guide explains the options that matter in 2026, which ones to avoid, and what Domain India's shared servers use.
On a server you run, use the event MPM with PHP-FPM through mod_proxy_fcgi, one FPM pool per site running as that site's user. That gives good concurrency, low memory use and user isolation. mod_php with prefork is the legacy setup; mod_ruid2 and mod_fastcgi are unmaintained. On Domain India shared hosting the server is set up for you: PHP runs per account through PHP-FPM, and you can't change the MPM or handler.
1. The two layers of an execution model
A third layer often sits in front: a reverse proxy such as nginx that accepts connections and passes them to Apache. It changes the picture, because Apache then sees fewer, shorter connections.
2. The three MPMs
| MPM | How it works | Use it when |
|---|---|---|
| prefork | One single-threaded process per connection | You must run mod_php or another module that isn't thread-safe |
| worker | Several processes, each with many threads | Rarely today; event does the same job better |
| event | Like worker, but idle keep-alive connections are handed to a listener thread | Almost always, with PHP-FPM or a proxied application |
Check which MPM is active with apachectl -V | grep MPM (or httpd -V on AlmaLinux and Rocky Linux). On Ubuntu and Debian, switch with a2dismod mpm_prefork and a2enmod mpm_event; on AlmaLinux and Rocky Linux, edit /etc/httpd/conf.modules.d/00-mpm.conf. HTTP/2 through mod_http2 needs event or worker.
The key setting is MaxRequestWorkers: the number of requests Apache serves at once. Size it to your RAM, together with your PHP-FPM pools, so the server never starts swapping. Our guide to tuning Apache and Nginx has starting values.
3. How Apache runs PHP
| Handler | Where PHP runs | Runs as | Status in 2026 |
|---|---|---|---|
| mod_php | Inside every Apache process | Apache's user | Legacy; forces prefork, no per-site isolation |
| CGI with suEXEC | A new process for every request | The site's user | Works, but slow under load |
| mod_fcgid | Persistent processes started by Apache | The site's user, with suEXEC | Maintained; used on some older panel setups |
| PHP-FPM with mod_proxy_fcgi | A separate pool of PHP workers | The pool's user, one pool per site | Current standard |
| mod_lsapi | CloudLinux's handler | The site's user | An option on CloudLinux servers |
Why PHP-FPM won. PHP runs outside Apache, so Apache can use the event MPM. Each site gets its own pool running as its own user, which isolates sites from each other. Workers stay alive between requests, so OPcache works well. And you can tune each pool's worker count, memory and timeouts separately.
A minimal virtual host that hands PHP to an FPM pool:
<VirtualHost *:443>
ServerName example.in
DocumentRoot /var/www/example.in/public
<FilesMatch "\.php$">
SetHandler "proxy:unix:/run/php-fpm/example.in.sock|fcgi://localhost"
</FilesMatch>
</VirtualHost>And the matching pool, running as the site's own user:
[example.in]
user = example
group = example
listen = /run/php-fpm/example.in.sock
listen.owner = apache
listen.group = apache
pm = ondemand
pm.max_children = 10
pm.process_idle_timeout = 30s
request_terminate_timeout = 120sThe socket path and the web server's user (apache on AlmaLinux and Rocky Linux, www-data on Ubuntu and Debian) vary by distribution; match them to your system. With PHP-FPM, PHP settings go in the pool file, php.ini or .user.ini. A php_value line in .htaccess only works with mod_php and causes a 500 error otherwise.
4. Privilege separation: running code as the right user
On a server with several sites or users, code from one site must not be able to read another's files. The options:
- PHP-FPM pools per user. The modern answer: each pool runs as its site's user, and file permissions do the rest.
- suEXEC. Runs CGI and FastCGI programs as the owner of the virtual host. Still maintained and used with CGI and
mod_fcgid. - mod_ruid2. Switched Apache's own user per request. It is unmaintained and was never compatible with every module; don't use it on a new server.
- mpm-itk. Runs each virtual host's Apache processes as a different user. It works, but needs prefork and uses a lot of memory.
On shared hosting, providers add operating-system isolation too. CloudLinux, for example, puts each account in its own virtual file system and enforces per-account CPU, memory and process limits.
5. Other languages: proxy models
For applications that run their own server process, Apache acts as a reverse proxy:
- Node.js, Python (Gunicorn or Uvicorn), Go, Ruby (Puma): run the app on a local port or socket and forward to it with
mod_proxy_http(ProxyPass / http://127.0.0.1:3000/). - WebSockets:
mod_proxy_httphandles them on Apache 2.4.47 and later; older setups neededmod_proxy_wstunnel. - Python inside Apache:
mod_wsgiis still maintained and works, but a separate Gunicorn or Uvicorn process behind a proxy is more common. - Java: use
mod_proxy_httpto Tomcat's HTTP connector;mod_jkstill exists but is rarely needed for new setups. - Phusion Passenger: an application server that plugs into Apache and runs Node.js, Python and Ruby apps for you.
mod_fastcgi, which older guides mention, has been abandoned for years. Use mod_proxy_fcgi or mod_fcgid instead.
6. Troubleshooting common problems
- High memory, swapping. Usually prefork with
mod_php, or too many PHP-FPM workers for the RAM. Move to event with PHP-FPM and sizeMaxRequestWorkersandpm.max_childrentogether. - 503 or "server reached MaxRequestWorkers". All workers are busy. Check for slow PHP requests in the FPM slow log before raising the limit.
- Permission denied on files. The PHP pool's user can't read the files. Check owners and permissions, not just the Apache user.
- 502 or 504 from a proxy. The backend is down or slower than the proxy's timeout. Check the application's own log first.
- After a change, nothing works. Run
apachectl configtestbefore every reload, and read the error log (/var/log/httpd/error_logor/var/log/apache2/error.log).
7. What Domain India shared hosting uses
Measured on our servers on 24 September 2026:
| Server | Web server | How PHP runs |
|---|---|---|
| cPanel shared hosting | Apache with nginx in front | PHP-FPM pool per domain for most sites, CGI with suEXEC for the rest |
| DirectAdmin shared hosting | Apache with the event MPM | PHP-FPM |
Both servers run CloudLinux with per-account limits, and neither runs PHP as an Apache module. What this means for you:
- You choose your PHP version and settings in your control panel, but not the MPM or handler; see how to change your PHP version.
.htaccessandmod_rewritework, butphp_valueandphp_flaglines in.htaccesscause a 500 error. Use the MultiPHP INI Editor or.user.iniinstead.- On cPanel, requests that take longer than about 90 seconds end in a 504 from the nginx proxy, whatever
max_execution_timesays. See resolving gateway errors. - To see which handler your domain uses, see PHP-FPM in cPanel.
8. Where Domain India fits
If you want a server where the execution model is already chosen and maintained, shared hosting gives you that. If you want to choose the MPM, handler and pool sizes yourself, a VPS is self-managed with full root access; cPanel is not offered on a VPS. The cards show Domain India list prices on 19 September 2026, excluding 18% GST.
- 25 GB NVMe SSD Storage
- 50 GB Monthly Bandwidth
- 1 Website
- 10 Email Accounts
- 1 vCPU
- 2 GB DDR4 RAM
- 64 GB NVMe SSD Storage
- 2 TB Monthly Bandwidth
Frequently asked questions
Which Apache MPM should I use?
Use the event MPM on almost every modern server, with PHP running in PHP-FPM. Prefork is only needed if you must run mod_php or another module that isn't thread-safe.
Is mod_php still a good choice?
Not for new servers. mod_php loads PHP into every Apache process, which forces the prefork MPM, uses more memory and runs every site as the same user. PHP-FPM with mod_proxy_fcgi is the current standard.
What is the difference between suEXEC and PHP-FPM?
suEXEC makes Apache run CGI and FastCGI programs as the site owner's user. PHP-FPM runs PHP in separate pools, each configured with its own user. Both isolate sites; PHP-FPM is faster because its workers stay running between requests.
Should I use mod_ruid2?
No. mod_ruid2 is no longer maintained and conflicts with some modules. Use a PHP-FPM pool per user instead.
Can I change the Apache MPM or PHP handler on Domain India shared hosting?
No. These are server-wide settings managed by Domain India. You can change your PHP version and PHP settings in your control panel. For full control, use a VPS.
Why does php_value in .htaccess give a 500 error?
php_value and php_flag only work when PHP runs as an Apache module. With PHP-FPM or CGI, as on Domain India shared hosting, put settings in .user.ini or the control panel's PHP settings instead.
Ready to choose? Compare cPanel hosting and VPS plans, or open a support ticket if your site needs a PHP setting you can't change yourself.
Tell us what your site runs and how busy it is, and our support team will recommend shared hosting or a VPS.
Ask our team