Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable xdebug only when starting server with --xdebug #609

Merged
merged 3 commits into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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