Skip to content

Commit

Permalink
Merge pull request #23 from flownative/xdebug-configuration
Browse files Browse the repository at this point in the history
Provide more Xdebug configuration options
  • Loading branch information
robertlemke authored Apr 23, 2023
2 parents 56cd173 + db84a72 commit 24a73e7
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 19 deletions.
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2017 - 2023 Robert Lemke, Flownative GmbH

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.

41 changes: 22 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,25 +65,28 @@ similar mechanism in Kubernetes or your actual platform.

### Environment variables

| Variable Name | Type | Default | Description |
| ----------------------- | ------- | -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| PHP_BASE_PATH | string | /opt/flownative/php | Base path for PHP (read-only) |
| PHP_DATE_TIMEZONE | string | UTC | Default timezone ([doc](https://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone)) |
| PHP_ERROR_REPORTING | string | 2147483647 | PHP error reporting log levels ([doc](https://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting)) |
| PHP_DISPLAY_ERRORS | string | off | Display PHP errors ([doc](https://www.php.net/manual/en/errorfunc.configuration.php#ini.display-errors)) |
| PHP_ERROR_LOG | string | /dev/stderr | Path leading to the file where PHP errors should be logged |
| PHP_FPM_ERROR_LOG_PATH | string | /opt/flownative/log/php-fpm-error.log | Path leading to the file where PHP-FPM errors should be logged |
| PHP_FPM_ACCESS_LOG_PATH | string | /opt/flownative/log/php-fpm-access.log | Path leading to the file where PHP-FPM access should be logged |
| PHP_MEMORY_LIMIT | string | 750M | PHP memory limit ([doc](https://www.php.net/manual/en/ini.core.php#ini.memory-limit)) |
| PHP_OPCACHE_PRELOAD | string | | Path and filename of a preload script ([doc](https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.preload)) |
| PHP_XDEBUG_ENABLE | boolean | false | Enable or disable the Xdebug extension |
| PHP_IGBINARY_ENABLE | boolean | false | Enable or disable the igbinary extension |
| PHP_FPM_USER | string | 1000 | User id for running PHP (read-only) |
| PHP_FPM_GROUP | string | 1000 | Group id for running PHP (read-only) |
| PHP_FPM_PORT | string | 9000 | Port the PHP-FPM process listens to |
| PHP_FPM_MAX_CHILDREN | string | 20 | Maximum number of children to run |
| PHP_FPM_PM_MODE | string | ondemand | Process manager mode for PHP-FPM; "static", "ondemand" or "dynamic" |
| | | | |
| Variable Name | Type | Default | Description |
|---------------------------------|---------|----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|
| PHP_BASE_PATH | string | /opt/flownative/php | Base path for PHP (read-only) |
| PHP_DATE_TIMEZONE | string | UTC | Default timezone ([doc](https://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone)) |
| PHP_ERROR_REPORTING | string | 2147483647 | PHP error reporting log levels ([doc](https://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting)) |
| PHP_DISPLAY_ERRORS | string | off | Display PHP errors ([doc](https://www.php.net/manual/en/errorfunc.configuration.php#ini.display-errors)) |
| PHP_ERROR_LOG | string | /dev/stderr | Path leading to the file where PHP errors should be logged |
| PHP_FPM_ERROR_LOG_PATH | string | /opt/flownative/log/php-fpm-error.log | Path leading to the file where PHP-FPM errors should be logged |
| PHP_FPM_ACCESS_LOG_PATH | string | /opt/flownative/log/php-fpm-access.log | Path leading to the file where PHP-FPM access should be logged |
| PHP_MEMORY_LIMIT | string | 750M | PHP memory limit ([doc](https://www.php.net/manual/en/ini.core.php#ini.memory-limit)) |
| PHP_OPCACHE_PRELOAD | string | | Path and filename of a preload script ([doc](https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.preload)) |
| PHP_XDEBUG_ENABLE | boolean | false | Enable or disable the Xdebug extension |
| PHP_XDEBUG_DISCOVER_CLIENT_HOST | boolean | false | If enabled, Xdebug will first try to connect to the client that made the HTTP request. See Xdebug manual for details |
| PHP_XDEBUG_CLIENT_HOST | string | host.xdebug.beach | Configures the IP address or hostname where Xdebug will attempt to connect to when initiating a debugging connection. See Xdebug manual for details |
| PHP_XDEBUG_MAX_NESTING_LEVEL | integer | 512 | Controls the protection mechanism for infinite recursion protection. See Xdebug manual for details |
| PHP_IGBINARY_ENABLE | boolean | false | Enable or disable the igbinary extension |
| PHP_FPM_USER | string | 1000 | User id for running PHP (read-only) |
| PHP_FPM_GROUP | string | 1000 | Group id for running PHP (read-only) |
| PHP_FPM_PORT | string | 9000 | Port the PHP-FPM process listens to |
| PHP_FPM_MAX_CHILDREN | string | 20 | Maximum number of children to run |
| PHP_FPM_PM_MODE | string | ondemand | Process manager mode for PHP-FPM; "static", "ondemand" or "dynamic" |
| | | | |

## Security aspects

Expand Down
4 changes: 4 additions & 0 deletions root-files/opt/flownative/lib/php-fpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ export PHP_ERROR_LOG="${PHP_ERROR_LOG:-/dev/stderr}"
export PHP_OPCACHE_PRELOAD="${PHP_OPCACHE_PRELOAD:-}"
export PHP_XDEBUG_ENABLE="${PHP_XDEBUG_ENABLE:-false}"
export PHP_XDEBUG_DISCOVER_CLIENT_HOST="${PHP_XDEBUG_DISCOVER_CLIENT_HOST:-false}"
export PHP_XDEBUG_CLIENT_HOST="${PHP_XDEBUG_CLIENT_HOST:-host.xdebug.beach}"
export PHP_XDEBUG_MAX_NESTING_LEVEL="${PHP_XDEBUG_MAX_NESTING_LEVEL:-512}"
export PHP_IGBINARY_ENABLE="${PHP_IGBINARY_ENABLE:-false}"
export PHP_FPM_USER="1000"
Expand Down
6 changes: 6 additions & 0 deletions root-files/opt/flownative/php/etc/php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -265,4 +265,10 @@ opcache.save_comments=1
; requests out of the box, until the server is shut down.
opcache.preload = ${PHP_OPCACHE_PRELOAD}

[xdebug]
; The extension is loaded via /opt/flownative/php/etc/conf.d/php-ext-xdebug.ini, if PHP_XDEBUG_ENABLE is true

xdebug_enable=${PHP_XDEBUG_ENABLE}
xdebug.discover_client_host=${PHP_XDEBUG_DISCOVER_CLIENT_HOST}
xdebug.client_host=${PHP_XDEBUG_CLIENT_HOST}
xdebug.max_nesting_level=${PHP_XDEBUG_MAX_NESTING_LEVEL}

0 comments on commit 24a73e7

Please sign in to comment.