Skip to content

Commit

Permalink
Merge pull request #609 from humanmade/enable-xdebug
Browse files Browse the repository at this point in the history
Enable xdebug only when starting server with `--xdebug`
  • Loading branch information
joehoyle authored Aug 21, 2023
2 parents ecb29fa + 8d7dbd0 commit 2a2099e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
7 changes: 0 additions & 7 deletions docker/php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,3 @@

# Set sendmail to use mailhog.
sendmail_path = ${PHP_SENDMAIL_PATH}

# 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
9 changes: 9 additions & 0 deletions docker/xdebug.ini
Original file line number Diff line number Diff line change
@@ -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
24 changes: 15 additions & 9 deletions inc/composer/class-docker-compose-generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];

Expand All @@ -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' => [
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 2a2099e

Please sign in to comment.