Sign inSign up

xalauc/php-fpm

By xalauc

•Updated over 6 years ago

Image
0

1.3K

xalauc/php-fpm repository overview

⁠xalauc/php7-fpm

PHP VERSIONTAGS
7.17.1
7.17.2
7.1latest, 7.3

This image allows for running a php7 server in fpm mode to be run with a web server such as nginx, in fact it fits well with the xalauc/nginx server which exists as well.

⁠Environment Variables

A lot of the PHP.ini file is configurable using the Environment Variables for the docker machine, this allows for easy configuration of the PHP settings

If you want to override any configuration that is not available as an environment variable you can always mount a volume to replace the files below and roll your own file without the need for the environment variables.

⁠PHP.ini

The file is located: /etc/php7/php.ini

⁠Commonly Used
VARphpDefault Value
PHP_DISPLAY_ERRORSdisplay_errors0
PHP_ERROR_REPORTINGerror_reportingE_ALL & ~E_DEPRECATED & ~E_STRICT
PHP_MEMORY_LIMITmemory_limit128M
PHP_MAX_INPUT_VARSmax_input_vars1000
PHP_DATE_TIMEZONEdate.timezoneAustralia/Sydney
PHP_UPLOAD_MAX_FILESIZEupload_max_filesize100M
PHP_POST_MAX_SIZEpost_max_size200M
PHP_HTML_ERRORShtml_errorsOn
⁠The Rest
VARphpDefault Value
PHP_DISPLAY_STARTUP_ERRORSdisplay_startup_errors0
PHP_IGBINARY_COMPACT_STRINGSigbinary.compact_strings1
PHP_LOG_ERRORSlog_errors1
PHP_LOG_ERRORS_MAX_LENlog_errors_max_len10240
PHP_MAX_EXECUTION_TIMEmax_execution_time60
PHP_MAX_FILE_UPLOADSmax_file_uploads20
PHP_MAX_INPUT_TIMEmax_input_time60
PHP_OPCACHE_ENABLEopcache.enable1
PHP_OPCACHE_ENABLE_CLIopcache.enable_cli0
PHP_OPCACHE_MEMORY_CONSUMPTIONopcache.memory_consumption128
PHP_OPCACHE_INTERNED_STRINGS_BUFFERopcache.interned_strings_buffer32
PHP_OPCACHE_MAX_ACCELERATED_FILESopcache.max_accelerated_files10000
PHP_OPCACHE_USE_CWDopcache.use_cwd1
PHP_OPCACHE_VALIDATE_TIMESTAMPSopcache.validate_timestamps1
PHP_OPCACHE_REVALIDATE_FREQopcache.revalidate_freq2
PHP_OPCACHE_ENABLE_FILE_OVERRIDEopcache.enable_file_override0
PHP_OUTPUT_BUFFERINGoutput_buffering4096
PHP_PRECISIONprecision-1
PHP_REQUEST_ORDERrequest_orderGP
PHP_SERIALIZE_PRECISIONserialize_precision-1
PHP_SESSION_SERIALIZE_HANDLERsession.serialize_handlerphp_binary
PHP_SESSION_SAVE_HANDLERsession.save_handlerfiles
PHP_SESSION_SAVE_PATHsession.save_path/tmp
PHP_SESSION_GC_PROBABILITYsession.gc_probability1
PHP_SESSION_GC_DIVISORsession.gc_divisor10000
PHP_TRACK_ERRORStrack_errors0
PHP_VARIABLES_ORDERvariables_orderGPCS
PHP_ZEND_ASSERTIONSzend.assertions-1
⁠PHP.FPM

The file is located: /etc/php7/php-fpm.d/www.conf

VAROptionDefault Value
PHP_PMpmondemand
PHP_PM_MAX_CHILDRENpm.max_children100
PHP_PM_START_SERVERSpm.start_servers20
PHP_PM_MIN_SPARE_SERVERSpm.min_spare_servers20
PHP_PM_MAX_SPARE_SERVERSpm.max_spare_servers20
PHP_PM_PROCESS_IDLE_TIMEOUTpm.process_idle_timeout60s
PHP_PM_MAX_REQUESTSpm.max_requests500
⁠XDEBUG Only in the -dev versions

The file is located: /etc/php7/conf.d/xdebug.ini

VARphpDefault Value
XDEBUG_REMOTE_ENABLExdebug.remote_enable0
XDEBUG_REMOTE_HANDLERxdebug_remote_handlerdbgp
XDEBUG_REMOTE_CONNECT_BACKxdebug.remote_connect_back0
XDEBUG_IDEKEYxdebug.idekeyPHPSTORM
XDEBUG_REMOTE_AUTOSTARTxdebug.remote_autostart0
XDEBUG_REMOTE_PORTxdebug.remote_port9000
XDEBUG_REMOTE_HOSTxdebug.remote_hostlocalhost
XDEBUG_AUTO_TRACExdebug.auto_trace0
XDEBUG_TRACE_ENABLE_TRIGGERxdebug.trace_enable_trigger0
XDEBUG_TRACE_ENABLE_TRIGGER_VALUExdebug.trace_enable_trigger_value""
XDEBUG_TRACE_FORMATxdebug.trace_format0
XDEBUG_TRACE_OPTIONSxdebug.trace_options0
XDEBUG_TRACE_OUTPUT_DIRxdebug.trace_output_dir/app/xdebug/trace/
XDEBUG_TRACE_OUTPUT_NAMExdebug.trace_output_nametrace.%c
XDEBUG_PROFILER_AGGREGATExdebug.profiler_aggregate0
XDEBUG_PROFILER_APPENDxdebug.profiler_append0
XDEBUG_PROFILER_ENABLExdebug.profiler_enable0
XDEBUG_PROFILER_ENABLE_TRIGGERxdebug.profiler_enable_trigger0
XDEBUG_PROFILER_ENABLE_TRIGGER_VALUExdebug.profiler_enable_trigger_value""
XDEBUG_PROFILER_OUTPUT_DIRxdebug.profiler_output_dir/app/xdebug/profiler/
XDEBUG_PROFILER_OUTPUT_NAMExdebug.profiler_output_namecachegrind.out.%p

⁠Defined Volumes

⁠/app

This volume contains the codebase please note that this is not necessarily the web root as that is defined as part of the web server configuration.

⁠Exposed Ports

There are no exposed ports for this image as it is meant to be used in conjunction with another container running on a private network.

⁠Docker Compose

Below is an example docker compose file using this image:

version: '2'
services:
  nginx:
    image: "xalauc/nginx"
    restart: always
    links: 
      - php-fpm
    ports:
      - "80:80"
    volumes:
      - ./etc/nginx/conf.d:/etc/nginx/conf.d
      - ./app:/app
  php-fpm:
    image: "xalauc/php-fpm:7.1"
    restart: always
    links:
      - db
    environment:
      XDEBUG_ENABLE: 1
      XDEBUG_HOST: 10.0.75.1
      XDEBUG_REMOTE_PORT: 9000
    volumes:
      - ./app:/app
  db:
    image: "mariadb"
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: DEVELOPMENT
    volumes:
      - ./db:/var/lib/mysql

There is a file in the /etc/nginx/conf.d volume that is mounted in the above nginx configuration which allows for setting up the connection to the php-fpm box.

⁠site.conf
upstream php {
        server php-fpm:9000;
}

server {
        server_name 10.0.75.2;
        root /app/public;
        index index.php;

        location = /favicon.ico {
                log_not_found off;
                access_log off;
        }

        location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
        }

        location / {
                try_files $uri $uri/ /index.php?$args;
        }

        location ~ \.php$ {
                include fastcgi.conf;
                fastcgi_intercept_errors on;
                fastcgi_pass php;
        }

        location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
                expires max;
                log_not_found off;
        }
}

As you can see in the above all files with an extension of .php will be routed to the php-fpm server so that the php-fpm box does the heavy lifting for the PHP processing whilst the nginx webserver does what it does best.

For a complete working sample project please see: INSERT URL HERE

⁠License (MIT)

Copyright (c) 2018 Ben Blanks

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Tag summary

Content type

Image

Digest

Size

43.7 MB

Last updated

over 6 years ago

docker pull xalauc/php-fpm