AH00534: apache2: Configuration error: More than one MPM loaded.
indigital-kuba
PROOP

3 months ago

"More than one MPM loaded' It's appearing constantly during starting container, every service was synced from production environment with the same configuration, production environment is still running properly but not the dev one.
I tried solution from this guy https://station.railway.com/questions/urgent-all-wordpress-sites-deployed-to-07dee2ef#2qgv but this didn't helped

logs:
Mounting volume on: /var/lib/containers/railwayapp/bind-mounts/cc8dfd82-64d6-4cf9-80d1-40b7bc1a54a7/vol_ziqae2d7iero2fcd

Starting Container

Mounting volume on: /var/lib/containers/railwayapp/bind-mounts/cc8dfd82-64d6-4cf9-80d1-40b7bc1a54a7/vol_ziqae2d7iero2fcd

AH00534: apache2: Configuration error: More than one MPM loaded.

AH00534: apache2: Configuration error: More than one MPM loaded.

docker:
FROM php:8.2-apache

RUN apt-get update && apt-get install -y \

git \

unzip \

libzip-dev \

&& docker-php-ext-install zip mysqli pdo pdo_mysql \

&& apt-get clean && rm -rf /var/lib/apt/lists/*

COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

WORKDIR /var/www/html

COPY . .

RUN chown -R www-data:www-data /var/www/html/web/app \

&& chmod -R 775 /var/www/html/web/app

RUN composer install --no-dev --optimize-autoloader

ENV APACHE_DOCUMENT_ROOT /var/www/html/web

RUN sed -ri -e "s!/var/www/html!${APACHE_DOCUMENT_ROOT}!g" /etc/apache2/sites-available/*.conf && \

sed -ri -e "s!/var/www/!${APACHE_DOCUMENT_ROOT}!g" /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf

RUN echo "upload_max_filesize = 1024M" >> /usr/local/etc/php/conf.d/uploads.ini \

&& echo "post_max_size = 1024M" >> /usr/local/etc/php/conf.d/uploads.ini \

&& echo "memory_limit = 1536M" >> /usr/local/etc/php/conf.d/uploads.ini \

&& echo "max_execution_time = 600" >> /usr/local/etc/php/conf.d/uploads.ini \

&& echo "max_input_time = 600" >> /usr/local/etc/php/conf.d/uploads.ini

RUN a2enmod rewrite

EXPOSE 80

COPY entrypoint.sh /entrypoint.sh

RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]

$10 Bounty

6 Replies

3 months ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open itsrems 3 months ago


dardameiz
PRO

3 months ago

Try adding this to your entrypoint.sh

#!/bin/bash

a2dismod mpm_event

a2dismod mpm_prefork

apache2-foreground

If that dont work, just disable one:

#!/bin/bash

a2dismod mpm_event

apache2-foreground


alexxdf28-hue
FREE

3 months ago

Add the following command to your Dockerfile to disable the threaded MPMs (event and worker), forcing Apache to use mpm_prefork (which the PHP module requires).

You should place this command right after your RUN a2enmod rewrite command:

FROM php:8.2-apache

RUN apt-get update && apt-get install -y \

git \

unzip \

libzip-dev \

&& docker-php-ext-install zip mysqli pdo pdo_mysql \

&& apt-get clean && rm -rf /var/lib/apt/lists/*

COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

WORKDIR /var/www/html

COPY . .

RUN chown -R www-data:www-data /var/www/html/web/app \

&& chmod -R 775 /var/www/html/web/app

RUN composer install --no-dev --optimize-autoloader

ENV APACHE_DOCUMENT_ROOT /var/www/html/web

RUN sed -ri -e "s!/var/www/html!${APACHE_DOCUMENT_ROOT}!g" /etc/apache2/sites-available/*.conf && \

sed -ri -e "s!/var/www/!${APACHE_DOCUMENT_ROOT}!g" /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf

RUN echo "upload_max_filesize = 1024M" >> /usr/local/etc/php/conf.d/uploads.ini \

&& echo "post_max_size = 1024M" >> /usr/local/etc/php/conf.d/uploads.ini \

&& echo "memory_limit = 1536M" >> /usr/local/etc/php/conf.d/uploads.ini \

&& echo "max_execution_time = 600" >> /usr/local/etc/php/conf.d/uploads.ini \

&& echo "max_input_time = 600" >> /usr/local/etc/php/conf.d/uploads.ini

RUN a2enmod rewrite

RUN a2dismod mpm_event mpm_worker || true

EXPOSE 80

COPY entrypoint.sh /entrypoint.sh

RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]

2. If the Dockerfile Fix Fails (Debugging)

If the above fix doesn't work, the conflicting module must be loaded by a file copied in via COPY . . or in your entrypoint.sh.

You should check these two sources for explicit LoadModule directives:

  1. Checkentrypoint.sh: If you are running a2enmod mpm_prefork or similar commands inside your entrypoint.sh after Apache has been initialized, remove it.

  2. Check Configuration Files: Look for any custom Apache configuration files (e.g., in a local .apache/ directory that is copied into the container) that contain a LoadModule line for an MPM, especially if you are copying a full httpd.conf or a custom file that includes:

    • LoadModule mpm_event_module ...

    • LoadModule mpm_worker_module ...

You should only ever have one of the three MPM modules loaded. The php:8.2-apache image should take care of enabling the correct one (mpm_prefork), and the a2dismod command ensures any others are disabled.

I hope this helps!


nipponflex-bytebio
PRO

3 months ago

I'm also having the same problem; I opened a support ticket just like yours. The problem started on Friday, December 12th.


thiagobhmg
PRO

3 months ago

Solution: "More than one MPM loaded" Error on Railway (PHP + Apache)

Problem Context

Hello! I had the same issue when deploying a PHP application on Railway using the

php:8.1-apache

image. The specific error was:

AH00534: apache2: Configuration error: More than one MPM loaded

This error occurs because multiple Apache MPM (Multi-Processing Module) modules are being loaded simultaneously, causing a conflict. Railway may automatically activate additional modules during deployment, generating this incompatibility.

Complete Solution

I was able to resolve this by creating a custom entrypoint script that disables all conflicting MPM modules and enables only

mpm_prefork

before starting Apache. Here's the step-by-step guide:

Step 1: Create the

docker-entrypoint.shScript

Create a file named

docker-entrypoint.shin the root of your project (or in your application's appropriate directory):

bash

#!/bin/bash

set -e

# Disable all MPM modules to avoid conflicts

a2dismod mpm_event 2>/dev/null || true

a2dismod mpm_worker 2>/dev/null || true

a2dismod mpm_prefork 2>/dev/null || true

# Enable only mpm_prefork

a2enmod mpm_prefork

# Start Apache in foreground

exec apache2-foreground

Script Explanation:

a2dismod mpm_*

: Disables all MPM modules that might be active

2>/dev/null || true

: Suppresses error messages if the module is already disabled

a2enmod mpm_prefork

: Enables only the

mpm_prefork

module (compatible with PHP)

exec apache2-foreground

: Starts Apache in foreground mode (required for Docker containers)

Step 2: Update the Dockerfile

Modify your

Dockerfileto copy and use the custom entrypoint. Here's a complete example:

dockerfile

FROM php:8.1-apache

# Install PHP extensions (adjust according to your needs)

RUN docker-php-ext-install pdo pdo_mysql mysqli

# Enable Apache modules

RUN a2enmod rewrite headers

# Set working directory

WORKDIR /var/www/html

# Copy application files

COPY . /var/www/html/

# Set permissions

RUN chown -R www-data:www-data /var/www/html

# Expose port 80

EXPOSE 80

# Copy and setup entrypoint script (fixes MPM conflict on Railway)

COPY docker-entrypoint.sh /usr/local/bin/

RUN chmod +x /usr/local/bin/docker-entrypoint.sh

# Start Apache via custom entrypoint

CMD ["/usr/local/bin/docker-entrypoint.sh"]

Important Points:

  1. Adjust the COPY path: If your application is in a monorepo or subdirectory, adjust the

    COPY

    path as needed. For example:

    dockerfile

    COPY my-folder/docker-entrypoint.sh /usr/local/bin/

  2. Execution permissions: The

    chmod +x

    is essential to make the script executable inside the container.

  3. PHP Extensions: Adjust the

    RUN docker-php-ext-install

    line according to your project's needs (e.g., add

    curl

    ,

    gd

    ,

    zip

    , etc.).

Step 3: Deploy to Railway

After creating the files:

  1. Commit and Push to your GitHub repository:

    bash

    git add Dockerfile docker-entrypoint.sh

    git commit -m "fix: Add custom entrypoint to resolve MPM conflict"

    git push origin main

  2. Configure Railway to build from your repository

  3. Deploy: Railway will automatically detect the Dockerfile and build


Status changed to Open brody 3 months ago


nealoke
HOBBY

a month ago

Deploying a base docker container (like Matomo) is crashing purely because of this issue. It seems to affect quite some people, I think it is quite bad that this happens especially since it has nothing to do with the container but purely the service Railway is supposed to offer.


jeison-araya
PRO

a month ago

I have the same problem. Locally the container works as expected. On Railway is crashing with the same error "AH00534: apache2: Configuration error: More than one MPM loaded.".


Loading...