FROM php:8.2-apache # 1. Enable mod_rewrite for your .htaccess file RUN a2enmod rewrite # 2. Allow .htaccess to override directory settings RUN sed -ri -e 's/AllowOverride None/AllowOverride All/g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf # 3. Copy your application files and install database drivers COPY . /var/www/html/ RUN docker-php-ext-install mysqli pdo pdo_mysql EXPOSE 80 # 4. FIX FOR RAILWAY: Explicitly disable conflicting MPMs right before starting Apache CMD ["/bin/bash", "-c", "a2dismod mpm_event mpm_worker && a2enmod mpm_prefork && apache2-foreground"]