docker-phpfpm icon indicating copy to clipboard operation
docker-phpfpm copied to clipboard

Lightweight (~100mb) Docker PHP FPM for both arm and amd arch on alpine 3.17+ with PHP8.0.30/8.1.29/8.2.23/8.3.11 (also 7.4.33) with ~80-84 useful extensions (you can disable not necessary ones easily...

docker-phpfpm

Docker build Donate 15 Donate 25 Donate 50 Tweet

Docker PHP FPM with lean alpine base. The download size is just about ~150MB.

It contains PHP8.1.11 and PHP8.0.24 with plenty of common and useful extensions.

You can also continue using adhocore/phpfpm:7.4 for PHP7.4.30.

If you are looking for a complete local development stack then check adhocore/lemp.

It comes prepackaged with composer - both v1 and v2. Use composer command for v2 and composer1 for v1.

Usage

To pull latest image:

docker pull adhocore/phpfpm:8.1

# or for php 8.0
docker pull adhocore/phpfpm:8.0

# or for php 7.4
docker pull adhocore/phpfpm:7.4

8.2RC

8.2 is release candidate and not yet production ready, but of course you can test/develop on it locally.

docker pull adhocore/phpfpm:8.2

To use in docker-compose

# ./docker-compose.yml
version: '3'

services:
  phpfpm:
    image: adhocore/phpfpm:8.0
    container_name: phpfpm
    volumes:
      - ./path/to/your/app:/var/www/html
      # Here you can also volume php ini settings
      # - /path/to/zz-overrides:/usr/local/etc/php/conf.d/zz-overrides.ini
    ports:
      - 9000:9000
    environment:
      # ...

Composer

Latest versions of both Composer v1 and v2 are installed already. You can run v2 with composer and v1 with composer1.

Extensions

xdebug is installed but disabled by default for performance reason, just run docker-php-ext-enable xdebug to enable it again without having to rebuild/recompile.

Below you can find list of extensions by image tags.

PHP8.2

The following PHP extensions are installed in adhocore/phpfpm:8.2:

PHP 8.2.0RC4, Total extensions: 82
- apcu              - ast               - bcmath            - bz2               
- calendar          - core              - ctype             - curl              
- date              - dom               - ds                - ev                
- exif              - fileinfo          - filter            - fpm               
- ftp               - gd                - gettext           - gmp               
- hash              - iconv             - igbinary          - imagick           
- imap              - intl              - json              - ldap              
- libxml            - lzf               - mbstring          - memcached         
- mongodb           - msgpack           - mysqli            - mysqlnd           
- oauth             - openssl           - pcntl             - pcov              
- pcre              - pdo               - pdo_mysql         - pdo_pgsql         
- pdo_sqlite        - pgsql             - phar              - posix             
- pspell            - psr               - random            - rdkafka           
- readline          - redis             - reflection        - session           
- shmop             - simdjson          - simplexml         - soap              
- sodium            - spl               - sqlite3           - ssh2              
- standard          - sysvmsg           - sysvsem           - sysvshm           
- tidy              - tokenizer         - uuid              - xdebug            
- xhprof            - xlswriter         - xml               - xmlreader         
- xmlwriter         - xsl               - yaml              - zend opcache      
- zip               - zlib

PHP8.1

The following PHP extensions are installed in adhocore/phpfpm:8.1:

PHP 8.1.11, Total extensions: 86
- apcu              - ast               - bcmath            - bz2               
- calendar          - core              - ctype             - curl              
- date              - dom               - ds                - ev                
- exif              - fileinfo          - filter            - fpm               
- ftp               - gd                - gettext           - gmp               
- grpc              - hash              - iconv             - igbinary          
- imagick           - imap              - intl              - json              
- ldap              - libxml            - lzf               - mbstring          
- memcached         - mongodb           - msgpack           - mysqli            
- mysqlnd           - oauth             - openssl           - pcntl             
- pcov              - pcre              - pdo               - pdo_mysql         
- pdo_pgsql         - pdo_sqlite        - pgsql             - phalcon           
- phar              - posix             - pspell            - psr               
- rdkafka           - readline          - redis             - reflection        
- session           - shmop             - simdjson          - simplexml         
- soap              - sockets           - sodium            - spl               
- sqlite3           - ssh2              - standard          - swoole            
- sysvmsg           - sysvsem           - sysvshm           - tidy              
- tokenizer         - uuid              - xdebug            - xhprof            
- xlswriter         - xml               - xmlreader         - xmlwriter         
- xsl               - yaf               - yaml              - zend opcache      
- zip               - zlib

PHP8.0

The following PHP extensions are installed in adhocore/phpfpm:8.0:

PHP 8.0.24, Total extensions: 86
- apcu              - ast               - bcmath            - bz2               
- calendar          - core              - ctype             - curl              
- date              - dom               - ds                - ev                
- exif              - fileinfo          - filter            - fpm               
- ftp               - gd                - gettext           - gmp               
- grpc              - hash              - iconv             - igbinary          
- imagick           - imap              - intl              - json              
- ldap              - libxml            - lzf               - mbstring          
- memcached         - mongodb           - msgpack           - mysqli            
- mysqlnd           - oauth             - openssl           - pcntl             
- pcov              - pcre              - pdo               - pdo_mysql         
- pdo_pgsql         - pdo_sqlite        - pgsql             - phalcon           
- phar              - posix             - pspell            - psr               
- rdkafka           - readline          - redis             - reflection        
- session           - shmop             - simdjson          - simplexml         
- soap              - sockets           - sodium            - spl               
- sqlite3           - ssh2              - standard          - swoole            
- sysvmsg           - sysvsem           - sysvshm           - tidy              
- tokenizer         - uuid              - xdebug            - xhprof            
- xlswriter         - xml               - xmlreader         - xmlwriter         
- xsl               - yaf               - yaml              - zend opcache      
- zip               - zlib

PHP7.4

The following PHP extensions are installed in adhocore/phpfpm:7.4:

PHP 7.4.32, Total extensions: 87
- apcu              - ast               - bcmath            - bz2               
- calendar          - core              - ctype             - curl              
- date              - dom               - ds                - ev                
- event             - exif              - fileinfo          - filter            
- fpm               - ftp               - gd                - gettext           
- gmp               - grpc              - hash              - hrtime            
- iconv             - igbinary          - imagick           - imap              
- intl              - json              - ldap              - libxml            
- lua               - lzf               - mbstring          - memcached         
- mongodb           - msgpack           - mysqli            - mysqlnd           
- oauth             - openssl           - pcntl             - pcov              
- pcre              - pdo               - pdo_mysql         - pdo_pgsql         
- pdo_sqlite        - pgsql             - phalcon           - phar              
- posix             - psr               - rdkafka           - readline          
- redis             - reflection        - session           - simdjson          
- simplexml         - soap              - sockets           - sodium            
- spl               - sqlite3           - ssh2              - standard          
- swoole            - sysvmsg           - sysvsem           - sysvshm           
- tideways_xhprof   - tidy              - tokenizer         - uuid              
- xdebug            - xlswriter         - xml               - xmlreader         
- xmlwriter         - yaf               - yaml              - zend opcache      
- zephir parser     - zip               - zlib

Read more about pcov, psr

Production Usage

For production you may want to get rid of some extensions that are not really required. In such case, you can build a custom image on top adhocore/phpfpm:8.0 like so:

FROM adhocore/phpfpm:8.0

# Disable extensions you won't need. You can add as much as you want separated by space.
RUN docker-php-ext-disable xdebug pcov ldap

docker-php-ext-disable is shell script available in adhocore/phpfpm:8.0 only and not in official PHP docker images.

Extensions disabled can be re enabled with docker-php-ext-enable later again without the overhead of recompiling/rebuilding all over again.