Skip to content

Commit

Permalink
Merge pull request #410 from cytopia/php-7-4
Browse files Browse the repository at this point in the history
Adding PHP-FPM 7.4-dev (Seven Four)
  • Loading branch information
cytopia authored Nov 3, 2018
2 parents 528eb45 + a3dcc12 commit 4b8d60f
Show file tree
Hide file tree
Showing 20 changed files with 381 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .devilbox/www/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


$DEVILBOX_VERSION = 'v0.15';
$DEVILBOX_DATE = '2018-11-02';
$DEVILBOX_DATE = '2018-11-03';
$DEVILBOX_API_PAGE = 'devilbox-api/status.json';

//
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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/*
Expand Down
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Empty file added cfg/php-fpm-7.4/.keepme
Empty file.
54 changes: 54 additions & 0 deletions cfg/php-fpm-7.4/README.md
Original file line number Diff line number Diff line change
@@ -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.
80 changes: 80 additions & 0 deletions cfg/php-fpm-7.4/devilbox-fpm.conf-default
Original file line number Diff line number Diff line change
@@ -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:
46 changes: 46 additions & 0 deletions cfg/php-fpm-7.4/devilbox-fpm.conf-pm_dynamic
Original file line number Diff line number Diff line change
@@ -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:
39 changes: 39 additions & 0 deletions cfg/php-fpm-7.4/devilbox-fpm.conf-pm_ondemand
Original file line number Diff line number Diff line change
@@ -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:
Empty file added cfg/php-ini-7.4/.keepme
Empty file.
26 changes: 26 additions & 0 deletions cfg/php-ini-7.4/README.md
Original file line number Diff line number Diff line change
@@ -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.
Loading

0 comments on commit 4b8d60f

Please sign in to comment.