Skip to content

Instantly share code, notes, and snippets.

@tigusigalpa
Created August 6, 2025 02:42
Show Gist options
  • Save tigusigalpa/6eeb74369cacf17a1fdf0d5debe76592 to your computer and use it in GitHub Desktop.
Save tigusigalpa/6eeb74369cacf17a1fdf0d5debe76592 to your computer and use it in GitHub Desktop.
PHP 7.4 FPM Dockerfile with MySQL/Postgres support
FROM php:7.4-fpm
RUN apt -y update && apt -y install \
build-essential \
mc \
nano vim \
zip unzip libzip-dev \
openssl \
wget \
sendmail mailutils \
software-properties-common \
curl libcurl4-gnutls-dev \
net-tools \
build-essential \
libfreetype6-dev \
locales \
jpegoptim optipng pngquant gifsicle libpng-dev libjpeg62-turbo-dev libjpeg-dev libgd-dev \
git \
libonig-dev \
aspell \
ghostscript \
clamav \
apache2-utils \
libbz2-dev \
libkrb5-dev \
libmcrypt-dev \
libreadline-dev \
python3-dev python3-psycopg2 \
libxslt1-dev \
zlib1g-dev \
libpq-dev \
libfcgi-dev \
libssl-dev \
libc-client2007e libc-client2007e-dev
RUN apt -y clean && rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-install mbstring zip exif pcntl curl ctype intl xml fileinfo dom soap bcmath
RUN docker-php-ext-install pdo
# MySQL
#RUN docker-php-ext-install mysqli pdo_mysql
#RUN docker-php-ext-enable mysqli pdo_mysql
# PostgreSQL
#RUN docker-php-ext-install pgsql pdo_pgsql
#RUN docker-php-ext-enable pgsql pdo_pgsql
RUN docker-php-ext-install gd
#RUN sed -i 's/9000/9008/' /usr/local/etc/php-fpm.d/www.conf
#RUN sed -i 's/9000/9008/' /usr/local/etc/php-fpm.d/zz-docker.conf
WORKDIR /var/www/html
CMD ["php-fpm"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment