Select Page

Speed up your apache server running PHP

Speed up your apache server running PHP

Since I am facing performance problem due to the load of visitors and a badly configured server, I decide today to document my findings in this new series of articles.

As soon as PHP run as FastCGI and no more inside an Apache module ( is not multi threaded), You should be able to switch the default MPM setting of Apache from MPM prefork to MPM worker.

So, what’s the difference between prefork and worker?

Quoting from the Apache MPM Prefork page:
MPM Prefork implements a non-threaded, pre-forking web server that handles requests in a manner similar to Apache 1.3.

And for the Apache MPM Worker says:
MPM Worker implements a hybrid multi-process multi-threaded server. By using threads to serve requests, it is able to serve a large number of requests with less system resources than a process-based server.

Server: Strato (
Operating system: SuSE / openSuSE
Requirements: root access and basic Unix knowledge

1Edit the file  
# vi /etc/sysconfig/apache2

and change the key:




2You can now tune also  default parameters in file /etc/apache2/server-tuning.conf
Here are my settings, these are still the default setting of Apache

vi /etc/apache2/server-tuning.conf

# worker MPM

<IfModule worker.c>
    ServerLimit 16
    # initial number of server processes to start
    StartServers         2
    # minimum number of worker threads which are kept spare
    MinSpareThreads     25
    # maximum number of worker threads which are kept spare
    MaxSpareThreads     75
    # maximum number of simultaneous client connections
    MaxClients       150
    # constant number of worker threads in each server process
    ThreadsPerChild     25
    # maximum number of requests a server process serves
    MaxRequestsPerChild  6000

# apache2-reconfigure-mpm
this recreate the file  /etc/apache2/sysconfig.d/loadmodule.conf
and restart apache automatically. Test Your site to ensure everything still work as expected.
0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments


Would love your thoughts, please comment.x