Skip to content

Instantly share code, notes, and snippets.

@ohthehugemanatee
Created September 20, 2016 08:22
Show Gist options
  • Save ohthehugemanatee/720e9b7f9591bb6e13bca87f4ed42c10 to your computer and use it in GitHub Desktop.
Save ohthehugemanatee/720e9b7f9591bb6e13bca87f4ed42c10 to your computer and use it in GitHub Desktop.
Updates the xdebug hostname to "dockerhost", which is set to the host system's IP. This one actually requires "docker-compose restart", the service restart isn't enough.
#!/bin/bash
# To be run from inside the docker container. This script updates PHP settings to use the 'dockerhost' hostname
# rather than auto-discovery.
# The dockerhost hostname only works when your host machine has it's IP address in a variable called DOCKERHOST
# Fix host settings for web-based xdebug
sudo sed -i '/remote_connect_back/d' /etc/php/fpm-pool/drupal-xdebug.conf
sudo echo 'php_flag[xdebug.remote_connect_back] = off' >> /etc/php/fpm-pool/drupal-xdebug.conf
sudo echo 'php_admin_value[xdebug.remote_host] = "dockerhost"' >> /etc/php/fpm-pool/drupal-xdebug.conf
sudo service php7.0-fpm restart
echo "xdebug settings updated, php restarted."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment