Adding PHP-FPM 7.4

This commit is contained in:
cytopia 2018-11-02 22:55:15 +01:00
parent 528eb45738
commit 2e9f5e48c4
No known key found for this signature in database
GPG Key ID: 6D56EDB8695128A2
19 changed files with 380 additions and 7 deletions

View File

@ -14,7 +14,7 @@ putenv('RES_OPTIONS=retrans:1 retry:1 timeout:1 attempts:1');
$DEVILBOX_VERSION = 'v0.15';
$DEVILBOX_DATE = '2018-11-02';
$DEVILBOX_DATE = '2018-11-03';
$DEVILBOX_API_PAGE = 'devilbox-api/status.json';
//

3
.gitignore vendored
View File

@ -67,6 +67,7 @@
/cfg/php-ini-7.1/*.ini
/cfg/php-ini-7.2/*.ini
/cfg/php-ini-7.3/*.ini
/cfg/php-ini-7.4/*.ini
# Ignore custom PHP-FPM configs
/cfg/php-fpm-5.2/php-fpm.xml
@ -78,6 +79,7 @@
/cfg/php-fpm-7.1/*.conf
/cfg/php-fpm-7.2/*.conf
/cfg/php-fpm-7.3/*.conf
/cfg/php-fpm-7.4/*.conf
# Ignore custom PHP-FPM modules
/mod/php-fpm-5.2/*.so
@ -89,6 +91,7 @@
/mod/php-fpm-7.1/*.so
/mod/php-fpm-7.2/*.so
/mod/php-fpm-7.3/*.so
/mod/php-fpm-7.4/*.so
# Ignore custom bash and other confi files
/bash/*

View File

@ -50,6 +50,7 @@ env:
- S1=PHP V1=7.1 S2=HTTPD V2=apache-2.2
- S1=PHP V1=7.2 S2=HTTPD V2=apache-2.2
- S1=PHP V1=7.3 S2=HTTPD V2=apache-2.2
- S1=PHP V1=7.4 S2=HTTPD V2=apache-2.2
# PHP vs Apache 2.4
- S1=PHP V1=5.3 S2=HTTPD V2=apache-2.4
- S1=PHP V1=5.4 S2=HTTPD V2=apache-2.4
@ -59,6 +60,7 @@ env:
- S1=PHP V1=7.1 S2=HTTPD V2=apache-2.4
- S1=PHP V1=7.2 S2=HTTPD V2=apache-2.4
- S1=PHP V1=7.3 S2=HTTPD V2=apache-2.4
- S1=PHP V1=7.4 S2=HTTPD V2=apache-2.4
# PHP vs Nginx stable
- S1=PHP V1=5.3 S2=HTTPD V2=nginx-stable
- S1=PHP V1=5.4 S2=HTTPD V2=nginx-stable
@ -68,6 +70,7 @@ env:
- S1=PHP V1=7.1 S2=HTTPD V2=nginx-stable
- S1=PHP V1=7.2 S2=HTTPD V2=nginx-stable
- S1=PHP V1=7.3 S2=HTTPD V2=nginx-stable
- S1=PHP V1=7.4 S2=HTTPD V2=nginx-stable
# PHP vs Nginx mainline
- S1=PHP V1=5.3 S2=HTTPD V2=nginx-mainline
- S1=PHP V1=5.4 S2=HTTPD V2=nginx-mainline
@ -77,6 +80,7 @@ env:
- S1=PHP V1=7.1 S2=HTTPD V2=nginx-mainline
- S1=PHP V1=7.2 S2=HTTPD V2=nginx-mainline
- S1=PHP V1=7.3 S2=HTTPD V2=nginx-mainline
- S1=PHP V1=7.4 S2=HTTPD V2=nginx-mainline
###
### MYSQL

View File

@ -284,12 +284,27 @@ Every single attachable container comes with many different versions. In order t
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td><a target="_blank" title="PHP 7.4" href="https://github.com/devilbox/docker-php-fpm">7.4</a><sup>[2]</sup></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<strong><sup>[1]</sup></strong> <strong>PHP 5.2</strong> is available to use, but it is not officially supported. The Devilbox intranet does not work with this version as PHP 5.2 does not support namespaces.
Furthermore PHP 5.2 does only work with Apache 2.4, Nginx stable and Nginx mainline. It does not work with Apache 2.2. Use at your own risk.
<strong><sup>[2]</sup></strong> <strong>PHP 7.4</strong> is the upcoming unreleased version of PHP, which is directly built out of their [master](https://github.com/php/php-src/) branch.
It will improve every day as the image is rebuilt every day from the latest commits.
> **Documentation:**
> [Change container versions](https://devilbox.readthedocs.io/en/latest/getting-started/change-container-versions.html)

0
cfg/php-fpm-7.4/.keepme Normal file
View File

54
cfg/php-fpm-7.4/README.md Normal file
View File

@ -0,0 +1,54 @@
# PHP-FPM config directory
## General
* Add you custom php-fpm.conf files into this directory.
* Only files ending by `.conf` will be enabled
* Only files ending by `.conf` are ignored by git
## Example files
This directory also holds three example files:
| File | Description |
|---------------------------------|---------------------------------------------|
| `devilbox-fpm.conf-default` | Represents current PHP-FPM default settings |
| `devilbox-fpm.conf-pm_dynamic` | Example settings for dynamic workers |
| `devilbox-fpm.conf-pm_ondemand` | Example settings for ondemand workers |
* Do not edit these example files!
* Copy them to a new file (in case you want to use them)
## Worker configuration
When changing worker processes or scheduler, the following commands will come in handy
to monitor number of processes and memory consumption.
```bash
# Show current PHP-FPM child memory consumption in MB
ps -ylC php-fpm --sort:rss | awk '!/RSS/ { s+=$8 } END { printf "%dM\n", s/1024 }'
# (repeatedly) show current PHP-FPM child memory consumption in MB
watch --interval=1 "ps -ylC php-fpm --sort:rss | awk '"'!'"/RSS/ { s+=\$8 } END { printf \"%dM\n\", s/1024 }'"
# (repeatedly) Current number of PHP-FPM childs
watch --interval=1 "ps auxw | grep -E 'php-(cgi|fpm)' | grep -vE 'grep|master' | wc -l"
```
## Overwriting
If multiple `.conf` files are present in this directory specifying different values for the
same settings, the last file (alphabetically by filename) will overwrite any previous values.
## Compatibility
**Note:**
PHP-FPM 5.2 uses XML-style configuration and does not allow includes.
If you want to change php-fpm.conf for PHP-FPM 5.2 you need to adjust the main configuration file.
See `php-fpm-5.2/` directory.

View File

@ -0,0 +1,80 @@
; ############################################################
; Devilbox php-fpm.conf: Current default settings
; ############################################################
;
; Information
; -----------
; * Do not edit this file (it belongs to git)
; * This file shows example settings that are currently effective
; * If this file is enabled, nothing will change as it reflects the current default settings
;
; How to enable?
; --------------
; * Copy this file to another file with ".conf" extension
; * Only files with ".conf" extensions will be applied by PHP-FPM
; ###
; ### PHP-FPM global settings
; ###
;
[global]
; Error log level. Possible values: alert, error, warning, notice, debug. Default value: notice.
log_level = notice
; ###
; ### Pool configuratoin
; ###
[www]
; The timeout for serving a single request after which the worker process will be killed.
; This option should be used when the 'max_execution_time' ini option does not stop script
; execution for some reason.
request_terminate_timeout = 120s
; A maximum of backlog incoming connections will be queued for processing.
; If a connection request arrives with the queue full the client may receive an error with an
; indication of ECONNREFUSED, or, if the underlying protocol supports retransmission,
; the request may be ignored so that retries may succeed.
; This should not be greater than `cat /proc/sys/net/core/somaxconn`, otherwise connections
; are silently truncated
listen.backlog = 1024
; static - the number of child processes is fixed (pm.max_children).
;
; dynamic - the number of child processes is set dynamically based on the following directives:
; pm.max_children, pm.start_servers, pm.min_spare_servers, pm.max_spare_servers.
;
; ondemand - the processes spawn on demand (when requested, as opposed to dynamic, where
; pm.start_servers are started when the service is started.
pm = ondemand
; The maximum number of child processes to be created
pm.max_children = 50
; The number of child processes created on startup. Used only when pm is set to dynamic.
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2.
pm.start_servers = 4
; The desired minimum number of idle server processes.
pm.min_spare_servers = 2
; The desired maximum number of idle server processes.
pm.max_spare_servers = 6
; The number of requests each child process should execute before respawning.
; This can be useful to work around memory leaks in 3rd party libraries.
; For endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
; Default value: 0.
pm.max_requests = 500
; The number of seconds after which an idle process will be killed. Used only when pm is set to ondemand
pm.process_idle_timeout = 10s
; vim: set ft=dosini:

View File

@ -0,0 +1,46 @@
; ############################################################
; # Devilbox php-fpm.conf: dynamic example
; ############################################################
;
; Information
; -----------
; * Do not edit this file (it belongs to git)
; * This file show a possible dynamic example configuration
; * If this file is enabled, it will overwrite the current worker settings
;
; How to enable?
; --------------
; * Copy this file to another file with ".conf" extension
; * Only files with ".conf" extensions will be applied by PHP-FPM
; ###
; ### Pool configuratoin
; ###
[www]
; dynamic - the number of child processes is set dynamically based on the following directives:
pm = dynamic
; The maximum number of child processes to be created
pm.max_children = 50
; The number of child processes created on startup. Used only when pm is set to dynamic.
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2.
pm.start_servers = 4
; The desired minimum number of idle server processes.
pm.min_spare_servers = 2
; The desired maximum number of idle server processes.
pm.max_spare_servers = 6
; The number of requests each child process should execute before respawning.
; This can be useful to work around memory leaks in 3rd party libraries.
; For endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
; Default value: 0.
pm.max_requests = 500
; vim: set ft=dosini:

View File

@ -0,0 +1,39 @@
; ############################################################
; # Devilbox php-fpm.conf: ondemand example
; ############################################################
;
; Information
; -----------
; * Do not edit this file (it belongs to git)
; * This file show a possible ondemand example configuration
; * If this file is enabled, it will overwrite the current worker settings
;
; How to enable?
; --------------
; * Copy this file to another file with ".conf" extension
; * Only files with ".conf" extensions will be applied by PHP-FPM
; ###
; ### Pool configuratoin
; ###
[www]
; ondemand - the processes spawn on demand (when requested, as opposed to dynamic, where
; pm.start_servers are started when the service is started.
pm = ondemand
; The maximum number of child processes to be created
pm.max_children = 50
; The number of requests each child process should execute before respawning.
; This can be useful to work around memory leaks in 3rd party libraries.
; For endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
; Default value: 0.
pm.max_requests = 500
; The number of seconds after which an idle process will be killed.
pm.process_idle_timeout = 10s
; vim: set ft=dosini:

0
cfg/php-ini-7.4/.keepme Normal file
View File

26
cfg/php-ini-7.4/README.md Normal file
View File

@ -0,0 +1,26 @@
# PHP ini directory
## General
* Add you custom php.ini files into this directory.
* Only files ending by `.ini` will be enabled
* Only files ending by `.ini` are ignored by git
## Example files
This directory also holds two example files:
| File | Description |
|----------------------------|-----------------------------------------|
| `devilbox-php.ini-default` | Represents current PHP default settings |
| `devilbox-php.ini-xdebug ` | Example settings for Xdebug |
* Do not edit these example files!
* Copy them to a new file (in case you want to use them)
## Overwriting
If multiple `.ini` files are present in this directory specifying different values for the
same settings, the last file (alphabetically by filename) will overwrite any previous values.

View File

@ -0,0 +1,63 @@
; ############################################################
; # Devilbox php.ini: Current default settings
; ############################################################
;
; Information
; -----------
; * Do not edit this file (it belongs to git)
; * This file shows example settings that are currently effective
; * If this file is enabled, nothing will change as it reflects the current default settings
;
; How to enable?
; --------------
; * Copy this file to another file with ".ini" extension
; * Only files with ".ini" extensions will be applied by PHP
;
; PHP.ini configuration
;
[PHP]
; Memory
; Note: "memory_limit" should be larger than "post_max_size"
memory_limit = 512M
; Timeouts
max_execution_time = 120
max_input_time = 120
; Uploads
; Note: "post_max_size" should be greater than "upload_max_filesize"
post_max_size = 72M
upload_max_filesize = 64M
max_file_uploads = 20
; Vars
variables_order = EGPCS
max_input_vars = 8000
max_input_nesting_level = 64
; Error reporting
; Note: error_log is dynamic and handled during start to set appropriate setting
error_reporting = E_ALL | E_NOTICE | E_STRICT | E_DEPRECATED
xmlrpc_errors = Off
report_memleaks = On
display_errors = On
display_startup_errors = On
log_errors = On
html_errors = On
; Xdebug settings
xdebug.default_enable = Off
xdebug.profiler_enable = Off
xdebug.remote_enable = Off
xdebug.remote_autostart = Off
; vim: set ft=dosini:

View File

@ -0,0 +1,36 @@
; ############################################################
; # Devilbox php.ini: Xdebug example
; ############################################################
;
; Information
; -----------
; * Do not edit this file (it belongs to git)
; * This file show a possible Xdebug example configuration
; * If this file is enabled, it will overwrite the current Xdebug settings
;
; How to enable?
; --------------
; * Copy this file to another file with ".ini" extension
; * Only files with ".ini" extensions will be applied by PHP
;
; PHP.ini configuration
;
[PHP]
; Xdebug
; Use these settings to enable Xdebug for PHP
; Make sure to read up on Xdebug some settings might significantly slow down requests.
; The following is just an example configuration and should be adjusted
xdebug.default_enable = On
xdebug.profiler_enable = On
xdebug.remote_enable = On
xdebug.remote_autostart = On
xdebug.remote_handler = dbgp
xdebug.remote_port = 9000
xdebug.idekey = PHPSTORM
xdebug.remote_log = /var/log/php/xdebug.log
; vim: set ft=dosini:

View File

@ -95,7 +95,7 @@ services:
# PHP / HHVM
# ------------------------------------------------------------
php:
image: devilbox/php-fpm:${PHP_SERVER:-7.0}-work-0.44
image: devilbox/php-fpm:${PHP_SERVER:-7.0}-work-0.45
##
## All .env variables

View File

@ -528,11 +528,11 @@ PHP_SERVER
This variable choses your desired PHP-FPM version to be started.
+-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------+
+-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------+
| Name | Allowed values | Default value |
+=========================+=========================================================================================================================================================================================+=================+
| ``PHP_SERVER`` | ``php-fpm-5.2`` |br| ``php-fpm-5.3`` |br| ``php-fpm-5.4`` |br| ``php-fpm-5.5`` |br| ``php-fpm-5.6`` |br| ``php-fpm-7.0`` |br| ``php-fpm-7.1`` |br| ``php-fpm-7.2`` |br| ``php-fpm-7.3`` | ``php-fpm-7.1`` |
+-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------+
+=========================+==============================================================================================================================================================================================================+=================+
| ``PHP_SERVER`` | ``php-fpm-5.2`` |br| ``php-fpm-5.3`` |br| ``php-fpm-5.4`` |br| ``php-fpm-5.5`` |br| ``php-fpm-5.6`` |br| ``php-fpm-7.0`` |br| ``php-fpm-7.1`` |br| ``php-fpm-7.2`` |br| ``php-fpm-7.3`` |br| ``php-fpm-7.4`` | ``php-fpm-7.2`` |
+-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------+
.. important::
**PHP 5.2** is available to use, but it is not officially supported. The Devilbox intranet does
@ -558,6 +558,7 @@ All values are already available in the ``.env`` file and just need to be commen
PHP_SERVER=php-fpm-7.1
#PHP_SERVER=php-fpm-7.2
#PHP_SERVER=php-fpm-7.3
#PHP_SERVER=php-fpm-7.4
.. _env_httpd_server:

View File

@ -40,6 +40,7 @@ See the directory structure for PHP-FPM configuration directories inside ``./cfg
drwxr-xr-x 2 cytopia cytopia 4096 Mar 5 21:53 php-fpm-7.1/
drwxr-xr-x 2 cytopia cytopia 4096 Mar 5 21:53 php-fpm-7.2/
drwxr-xr-x 2 cytopia cytopia 4096 Mar 5 21:53 php-fpm-7.3/
drwxr-xr-x 2 cytopia cytopia 4096 Mar 5 21:53 php-fpm-7.4/
Customization is achieved by placing a file into ``cfg/php-fpm-X.X/`` (where ``X.X`` stands for
your PHP version). The file must end by ``.conf`` in order to be sourced by the PHP-FPM server.

View File

@ -33,6 +33,7 @@ See the directory structure for PHP configuration directories inside ``./cfg/``
drwxr-xr-x 2 cytopia cytopia 4096 Mar 5 21:53 php-ini-7.1/
drwxr-xr-x 2 cytopia cytopia 4096 Mar 5 21:53 php-ini-7.2/
drwxr-xr-x 2 cytopia cytopia 4096 Mar 5 21:53 php-ini-7.3/
drwxr-xr-x 2 cytopia cytopia 4096 Mar 5 21:53 php-ini-7.4/
Customization is achieved by placing a file into ``cfg/php-ini-X.X/`` (where ``X.X`` stands for
your PHP version). The file must end by ``.ini`` in order to be sourced by the PHP-FPM server.

View File

@ -88,6 +88,7 @@ It will look something like this:
PHP_SERVER=7.1
#PHP_SERVER=7.2
#PHP_SERVER=7.3
#PHP_SERVER=7.4
As you can see, all available values are already there, but commented. Only one is uncommented.
In this example it is ``7.1``, which is the PHP version that will be started, once the Devilbox
@ -111,6 +112,7 @@ In order to enable PHP 5.5, you would change the ``.env`` file like this:
#PHP_SERVER=7.1
#PHP_SERVER=7.2
#PHP_SERVER=7.3
#PHP_SERVER=7.4
Start the Devilbox
^^^^^^^^^^^^^^^^^^
@ -229,6 +231,7 @@ Consider this ``.env`` file:
#PHP_SERVER=7.1
#PHP_SERVER=7.2
#PHP_SERVER=7.3
#PHP_SERVER=7.4
Both, PHP 5.5 and PHP 7.0 are uncommented, however, when you start the Devilbox, it will use
PHP 7.0 as this value overwrites any previous ones.

View File

@ -232,6 +232,7 @@ DEVILBOX_UI_ENABLE=1
#PHP_SERVER=7.1
PHP_SERVER=7.2
#PHP_SERVER=7.3
#PHP_SERVER=7.4
###