Skip to content

Instantly share code, notes, and snippets.

@KrisKnez
Last active February 13, 2025 13:38
Show Gist options
  • Save KrisKnez/1180a4404d0cd5895e1678f179c0de9b to your computer and use it in GitHub Desktop.
Save KrisKnez/1180a4404d0cd5895e1678f179c0de9b to your computer and use it in GitHub Desktop.
PHP 5.6 DEV ENV
FROM php:5.6-apache AS final
# Use archived Debian repositories for old versions (apt-get update won't work otherwise)
RUN sed -i 's|http://deb.debian.org/debian|http://archive.debian.org/debian|g' /etc/apt/sources.list && \
sed -i 's|http://security.debian.org/debian-security|http://archive.debian.org/debian-security|g' /etc/apt/sources.list && \
# Remove or comment out the stretch-updates repository
sed -i '/stretch-updates/d' /etc/apt/sources.list && \
echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99no-check-valid-until
# Install system dependencies required for PHP extensions
RUN apt-get update && apt-get install
RUN apt-get install -y libpng-dev libjpeg-dev libfreetype6-dev libonig-dev libzip-dev zip unzip
# Install required PHP extensions
RUN docker-php-ext-install mbstring mysql mysqli pdo pdo_mysql zip
# Use development-optimized PHP configuration
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
# Enable Apache mod_rewrite
RUN a2enmod rewrite
# Set the user to www-data for security
USER www-data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment