Closed fchris82 closed 5 years ago
@fchris82 yup, i think i agree with this. we should completely disable/enable the extension vs disabling/enabling the remote settings
I am trying to run Behat inside of Lando and keep getting this:
Background: # features/admin-login.feature:6
Given I am logged in as an administrator # PaulGibbs\WordpressBehatExtension\Context\UserContext::iAmLoggedInAsRole()
Fatal error: Maximum function nesting level of '256' reached, aborting! (Behat\Testwork\Call\Exception\FatalThrowableError)
I’ve only seen Maximum function nesting level
style errors before when xdebug is on. I do not have xdebug
defined in my .lando.yml
and have also tried to explicitly set it to false
but it seems xdebug is still running.
Tried a restart, rebuild and even deleted my local Docker image to force container images to re-download but no luck.
It turned out to be the lh-hsts plugin. I am running Behat tests with a wp-cli driver and the plugin sends the site into a redirect loop as the wp-cli driver tries to authenticate with WordPress.
I've found a workaround to completely disable xdebug and ensure it doesn't get loaded:
lando ssh appserver --user=root
php --ini
apt-get update && apt-get install nano
nano /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
# comment out the only extension in that file
# exit and save
# logout from your ssh connection into appserver
lando restart
An easier way to accomplish this is using a build step in your lando recipe:
appserver:
type: php:7.1
config:
conf: config/php/php.ini
# xdebug: true
install_dependencies_as_root:
- "mkdir /usr/local/etc/php/conf.d/disabled_extensions && mv -vf /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini /usr/local/etc/php/conf.d/disabled_extensions/docker-php-ext-xdebug.ini"
To apply the changes, you need to run lando rebuild
.
When you need xdebug again, you invert the mv
instruction and un-comment the xdebug setting:
appserver:
type: php:7.1
config:
conf: config/php/php.ini
xdebug: true
install_dependencies_as_root:
- "mv -vf /usr/local/etc/php/conf.d/disabled_extensions/docker-php-ext-xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini "
To avoid rebuilding your app, I guess you can also log into appserver as root lando ssh appserver --user=root
and run...
mkdir /usr/local/etc/php/conf.d/disabled_extensions && mv -vf /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini /usr/local/etc/php/conf.d/disabled_extensions/docker-php-ext-xdebug.ini
... and then run lando restart
.
The gains in performance, so far, seem really worth it. I hope this may help.
@unknownterritory thanks for the tip! You could also use the -p parameter mkdir -p
to only create the directory if it doesn't exist if you don't want to have to worry about changing that line.
We have changed the behavior here so that the xdebug extension is actually disabled by default and enabled when xdebug: true
is set. This will be rolled out in RC2
We have a complex project which can became very slow when the xdebug is loaded. Currently the developers can switch ON or OFF the
xdebug
in thedocer-compose.yml
:And we have an
entrypoint.sh
file with this part:As I can see in the
plugins/lando-services/services/php/php.js
file, now if the configxdebug
value isfalse
, the program doesn't set the remote parameters:But it won't have an effect on the performance, and I can't switch off the xdebug, when I don't want to use it; and switch on, when I want it. In this form it is not very helpful. I think an
else
is required to really switch off xdebug.