GithubHelp home page GithubHelp logo

docker-centos7-php's Introduction

amazee.io centos7 php

amazee.io CentOS 7 Dockerfile with php-fpm installed, based on amazeeio/centos:7 Docker Image.

This Dockerfile is intended to be used as an base for any php needs within amazee.io. This image itself does not create a webserver, rather just an php-fpm fastcgi listener. You maybe need to adapt the php-fpm pool config.

  • PHP is installed via remirepo.net
  • PHP FPm Pool configs are expected inside /etc/php-fpm.d/
  • Composer is installed with the newest stable version

amazee.io & OpenShift adaptions

This image is prepared to be used on amazee.io which leverages OpenShift. There are therefore some things already done:

  • Folder permissions are automatically adapted with fix-permissions so this image will work with a random user and therefore also on OpenShift.
  • The /etc/php.ini and /etc/php-fpm.conf plus all files within /etc/php-fpm.d/ are parsed through envplate with an container-entrypoint.
  • See the Dockerfile for installed php modules

Included php config

The included php config contains sane values that will make the creation of php pools configs easier. Here a list these, check /etc/php.ini, /etc/php-fpm.conf for all of it:

  • max_execution_time = 900 (changeable via PHP_MAX_EXECUTION_TIME)
  • realpath_cache_size = 256k for handling big php projects
  • memory_limit = 400M for big php projects (changeable via PHP_MEMORY_LIMIT)
  • opcache.memory_consumption = 265 for big php projects
  • opcache.enable_file_override = 1 and opcache.huge_code_pages = 1 for faster php
  • display_errors = Off and display_startup_errors = Off for sane production values (changeable via PHP_DISPLAY_ERRORS and PHP_DISPLAY_STARTUP_ERRORS)
  • upload_max_filesize = 2048M for big file uploads
  • apc.shm_size = 32m and apc.enabled = 1 (changeable via PHP_APC_SHM_SIZE and PHP_APC_ENABLED)
  • php-fpm error logging happens in stderr

Hint: If you don't like any of these configs, you have three possibilities:

  1. If they are changeable via environment variables, use them (prefeered version, see list of environment variables below)
  2. Create your own fpm-pool config and set configs them via php_admin_value and php_admin_flag in there (learn more about them here - yes this refeers to Apache, but it is also the case for php-fpm). Important:
    1. If you like to provide your own php-fpm pool, overwrite the file /etc/php-fpm.d/www.conf with your own config or remove this file if you like another name. If you don't do that the provided pool will be started!
    2. PHP Values with the PHP_INI_SYSTEM changeable mode cannot be changed via an fpm-pool config. They need to changed either via already provided Environment variables or:
  3. Provide your own php.ini or php-fpm.conf file (least prefeered version)

default fpm-pool

This image is shipped with an fpm-pool config (php-fpm.d/www.conf) that creates a fpm-pool and listens on port 9000. This is because we try to provide an image which covers already most needs for PHP and so you don't need to create your own. You are happy to do so if you like though :) Here a short description of what this file does:

  • listens on port 9000 via ipv4 and ipv6
  • uses the pm dynamic and creates betwwen 2-20 children
  • respawns fpm pool children after 500 requests to prevent memory leaks
  • replies with pong when makeing an fastcgi request to /ping (good for automated testing if the pool started)
  • catch_workers_output = yes to see php errors
  • clear_env = no to be able to inject PHP environment variables via regular Docker environment variables

Environment Variables

Environment variables are meant to do common behavior changes of php.

Environment Variable Default Description
PHP_MAX_EXECUTION_TIME 900 Maximum execution time of each script, in seconds, see php.net
PHP_MEMORY_LIMIT 400M Maximum amount of memory a script may consume, see php.net
PHP_DISPLAY_ERRORS Off This determines whether errors should be printed to the screen as part of the output or if they should be hidden from the user, see php.net
PHP_DISPLAY_STARTUP_ERRORS Off Even when display_errors is on, errors that occur during PHP's startup sequence are not displayed. It's strongly recommended to keep it off, except for debugging., see php.net
PHP_APC_SHM_SIZE 32m The size of each shared memory segment given, see php.net
PHP_APC_ENABLED 1 Can be set to 0 to disable APC, see php.net

docker-centos7-php's People

Contributors

schnitzel avatar dasrecht avatar mkeating avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.