From 457a2de6b1f809ab1c0fa619efbd1a5b9ee5d68f Mon Sep 17 00:00:00 2001 From: Joe Hoyle Date: Wed, 2 Aug 2023 16:59:15 +0200 Subject: [PATCH 1/2] Enable xdebug We're going to disabled the xdebug extension in production in https://github.com/humanmade/docker-wordpress-php/pull/190 This re-enables it. It would be better to also only do this on `--xdebug`, so will follow up with that actually. --- docker/php.ini | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker/php.ini b/docker/php.ini index 9898d13b..d0edea55 100644 --- a/docker/php.ini +++ b/docker/php.ini @@ -4,6 +4,9 @@ sendmail_path = ${PHP_SENDMAIL_PATH} # XDebug +zend_extension=xdebug + +[Xdebug] xdebug.mode = debug xdebug.start_with_request = yes xdebug.var_display_max_children = 1024 From 8d7dbd0fb57e2031ed4daf8b8d45c796fa6c8d5a Mon Sep 17 00:00:00 2001 From: Joe Hoyle Date: Mon, 21 Aug 2023 09:12:05 +0200 Subject: [PATCH 2/2] Only enable the Xdebug extension with `--xdebug`. --- docker/php.ini | 10 -------- docker/xdebug.ini | 9 +++++++ .../class-docker-compose-generator.php | 24 ++++++++++++------- 3 files changed, 24 insertions(+), 19 deletions(-) create mode 100644 docker/xdebug.ini diff --git a/docker/php.ini b/docker/php.ini index d0edea55..0519a260 100644 --- a/docker/php.ini +++ b/docker/php.ini @@ -2,13 +2,3 @@ # Set sendmail to use mailhog. sendmail_path = ${PHP_SENDMAIL_PATH} - -# XDebug -zend_extension=xdebug - -[Xdebug] -xdebug.mode = debug -xdebug.start_with_request = yes -xdebug.var_display_max_children = 1024 -xdebug.var_display_max_data = -1 -xdebug.var_display_max_depth = 10 diff --git a/docker/xdebug.ini b/docker/xdebug.ini new file mode 100644 index 00000000..b4fa07e7 --- /dev/null +++ b/docker/xdebug.ini @@ -0,0 +1,9 @@ +# XDebug. Only loaded with local server is started with `--xdebug`. +zend_extension=xdebug + +[Xdebug] +xdebug.mode = debug +xdebug.start_with_request = yes +xdebug.var_display_max_children = 1024 +xdebug.var_display_max_data = -1 +xdebug.var_display_max_depth = 10 diff --git a/inc/composer/class-docker-compose-generator.php b/inc/composer/class-docker-compose-generator.php index 61f9cdd2..58def309 100644 --- a/inc/composer/class-docker-compose-generator.php +++ b/inc/composer/class-docker-compose-generator.php @@ -98,9 +98,9 @@ public function __construct( string $root_dir, string $project_name, string $tld */ protected function get_php_reusable() : array { $version_map = [ - '8.2' => 'humanmade/altis-local-server-php:8.2.3', - '8.1' => 'humanmade/altis-local-server-php:6.0.5', - '8.0' => 'humanmade/altis-local-server-php:5.0.4', + '8.2' => 'humanmade/altis-local-server-php:8.2.5', + '8.1' => 'humanmade/altis-local-server-php:6.0.7', + '8.0' => 'humanmade/altis-local-server-php:5.0.7', '7.4' => 'humanmade/altis-local-server-php:4.2.5', ]; @@ -120,6 +120,17 @@ protected function get_php_reusable() : array { $image = $version_map[ $version ]; + $volumes = [ + $this->get_app_volume(), + "{$this->config_dir}/php.ini:/usr/local/etc/php/conf.d/altis.ini", + 'socket:/var/run/php-fpm', + 'tmp:/tmp', + ]; + + if ( $this->args['xdebug'] !== 'off' ) { + $volumes[] = "{$this->config_dir}/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini"; + } + $services = [ 'init' => true, 'depends_on' => [ @@ -148,12 +159,7 @@ protected function get_php_reusable() : array { "proxy:s3-{$this->hostname}", "proxy:s3-{$this->project_name}.localhost", ], - 'volumes' => [ - $this->get_app_volume(), - "{$this->config_dir}/php.ini:/usr/local/etc/php/conf.d/altis.ini", - 'socket:/var/run/php-fpm', - 'tmp:/tmp', - ], + 'volumes' => $volumes, 'networks' => [ 'proxy', 'default',