Lewatkan ke konten utama

Konfigurasi Apache MPM Prefork + PHP (mod_php)

1️⃣ Nonaktifkan PHP-FPM

sudo systemctl stop php8.1-fpm
sudo systemctl disable php8.1-fpm

Nonaktifkan konfigurasi Apache FPM:

sudo a2disconf php8.1-fpm
sudo a2dismod proxy_fcgi

2️⃣ Aktifkan MPM Prefork

Matikan MPM Event:
sudo a2dismod mpm_event

Aktifkan Prefork:
sudo a2enmod mpm_prefork

3️⃣ Pastikan mod_php sesuai versi PHP terpasang:

sudo apt install libapache2-mod-php8.1

sudo a2enmod php8.1

4️⃣ Restart Apache Prefork

sudo systemctl restart php81.-fpm

sudo systemctl restart apache2

5️⃣ Cek MPM:

apachectl -V | grep -i mpm

Harus muncul:
Server MPM: prefork

6️⃣ Optimasi Prefork

sudo nano /etc/apache2/mods-available/mpm_prefork.conf

<IfModule mpm_prefork_module>
    StartServers           5
    MinSpareServers        5
    MaxSpareServers       10
    MaxRequestWorkers    150
    MaxConnectionsPerChild 3000
</IfModule>

sudo systemctl restart apache2