All Wordpress sites deployed to Railway crashed with error: "More than one MPM loaded"
alexander-cato
PROOP

17 days ago

Without any changes made to the deployment, all Wordpress sites hosted on Railway have crashed and are not serving traffic.

The deploy log error displayed is: AH00534: apache2: Configuration error: More than one MPM loaded.

Solved$20 Bounty

6 Replies

fra
HOBBYTop 5% Contributor

17 days ago

Can you check this link:
https://stackoverflow.com/a/25447262

Look in: /etc/httpd/conf.modules.d

You'll find a file called: 00-mpm.conf

keep just one of these:

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
#LoadModule mpm_worker_module modules/mod_mpm_worker.so
#LoadModule mpm_event_module modules/mod_mpm_event.so

I'm not 100% sure, I'm just relying on what I found online.

Did you update the docker image by any chance? can you double check if the image has changed? Which template are you using?

ps. before any change, do a backup


alexander-cato
PROOP

16 days ago

I stumbled across that myself as well though there doesn't appear to be a way to access the directory since the image crashes immediately.

No changes were made to the sites.

You can see for yourself if you attempt to deploy from scratch any of the available Wordpress templates that used to work for Railway, they will all fail with the same error. The same Wordpress image works on other hosting platforms.

I came across this GitHub issue and believe it may have something to do with Railway changing their platform infrastructure.https://github.com/docker-library/wordpress/discussions/869


fra
HOBBYTop 5% Contributor

16 days ago

I can see that php:8.4 has been updated 4 days ago:

https://hub.docker.com/layers/library/php/8.4-apache/images/sha256-63d1df5ea11815a071a46ba2633fada567fd41397d45fb133b78d6f3bb483123?context=repo

I never used the wp template, I don't know if it uses docker and which php version uses,but if it is using this image (with the latest tag) it might be they have changed something and now the image works in a different way compared to the previous version.


kozmo2854
FREE

14 days ago

I've faced the same issue with php:8.2-apache and also facing an issue with the apache port. Here's both fixes separated:
1. MPM Error
Add this to the end of your Dockerfile:

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

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

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

Create a new docker-entrypoint.sh file next to your Dockerfile:

#!/bin/bash

set -e

a2dismod mpm_event 2>/dev/null || true

a2dismod mpm_worker 2>/dev/null || true

a2dismod mpm_prefork 2>/dev/null || true

a2enmod mpm_prefork

exec apache2-foreground

2. Port error

If you have an issue with the apache not being reachable do the following:

Add this to the end of your Dockerfile:

# Configure Apache DocumentRoot to Laravel's public directory

ENV APACHE_DOCUMENT_ROOT=/var/www/html/public

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

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

# Copy and setup entrypoint script (fixes MPM at runtime - Railway re-enables modules)

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

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

# Expose port 8080 for Railway

EXPOSE 8080

# Start Apache via entrypoint

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

docker-entrypoint.sh same as in the first part.

Hope this helps. slightly_smiling_face emoji


anarchistmanifesto
TRIAL

14 days ago

Hey @alexander-cato

I ran into this exact error on my WP setup a few days back. Super annoying right.

@kozmo2854 nailed it with that Dockerfile tweak. I copied the MPM part and it fixed mine right away.

Just make sure you create that docker-entrypoint.sh file too.

Here is a quick step by step if you need.

First add this to end of Dockerfile

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

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

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

Then make docker-entrypoint.sh with this

#!/bin/bash

set -e

a2dismod mpm_event 2>/dev/null || true

a2dismod mpm_worker 2>/dev/null || true

a2dismod mpm_prefork 2>/dev/null || true

a2enmod mpm_prefork

exec apache2-foreground

Push and redeploy.

If it still crashes drop your full deploy logs here. We can debug.


alexander-cato
PROOP

13 days ago

Simpler solution that does not require modifying the docker allowing one to still pull the official image.

Modify the start command in Railway to include a2dismod mpm_worker && a2enmod mpm_prefork

For context, here is my complete start command that works with the official Wordpress image and most Railway templates. /bin/bash -c "echo 'ServerName 0.0.0.0' >> /etc/apache2/apache2.conf && echo 'DirectoryIndex index.php index.html' >> /etc/apache2/apache2.conf && echo 'upload_max_filesize = 50M' >> /usr/local/etc/php/php.ini && echo 'post_max_size = 50M' >> /usr/local/etc/php/php.ini && docker-entrypoint.sh a2dismod mpm_event && a2dismod mpm_worker && a2enmod mpm_prefork && apache2-foreground"


Status changed to Solved chandrika 13 days ago


Loading...