Customize PHP.ini and PHP extensions

All the marketplace apps using PHP (apache and alpine for instance) uses the basic image and configuration files provided by PHP on docker hub.

That means some useful extensions like redis or PDO are not activated and the php.ini is the default php.ini file published by PHP with low limits (2M upload file or 30 second max execution time for instances).

If you need to add extensions you can simply deploy a docker container from the marketplace and refer to this page to install the extension.

Example with PDO, simply deploy this Dockerfile directly from FlashDrive :

FROM php:7.4-apache
RUN docker-php-ext-install mysqli pdo pdo_mysql

Make sure to create a virtual disk with a path to /var/www/html/ according to Apache specs.

Another example with FPM and GD Extensions :

FROM php:7.4-fpm
RUN apt-get update && apt-get install -y \
        libfreetype6-dev \
        libjpeg62-turbo-dev \
        libpng-dev \
    && docker-php-ext-configure gd --with-freetype --with-jpeg \
    && docker-php-ext-install -j$(nproc) gd

If you need to customize the php.ini you can add a virtual drive with a path to /usr/local/etc/php and upload your php.ini using FileBrowser. Php.ini files can be found on Github

Alternatively flashdrive/apache-php is a docker image with increased values and some extensions installed. Code source is available here.

Was this helpful?

0 / 0