When you want to output to a file that requires you to use sudo, the answer is totally non-obvious!
sudo tee /etc/php/conf.d/xdebug.ini > /dev/null <<'TXT'
zend_extension=xdebug.so
xdebug.remote_enable=on
xdebug.remote_autostart=on
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
TXT