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

Working remote XDebug with NAT #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
9 changes: 9 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
require 'socket'

def my_first_private_ipv4
Socket.ip_address_list.detect{|intf| intf.ipv4_private?}
end

Vagrant::Config.run do |config|
# All Vagrant configuration is done here. For a detailed explanation
# and listing of configuration options, please view the documentation
Expand All @@ -13,6 +19,9 @@ Vagrant::Config.run do |config|
chef.json.merge!({
:mysql => {
:server_root_password => "root"
},
:php => {
:virtualbox_host_ip => my_first_private_ipv4.ip_address
}
})
end
Expand Down
7 changes: 7 additions & 0 deletions cookbooks/php/recipes/php5.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,10 @@
action :upgrade
end
end

template "/etc/php5/conf.d/xdebug_remote.ini" do
source "xdebug_remote.ini.erb"
owner "root"
group "root"
mode 0644
end
6 changes: 6 additions & 0 deletions cookbooks/php/templates/default/xdebug_remote.ini.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
xdebug.remote_enable=On
xdebug.remote_host="<%= node[:php][:virtualbox_host_ip] %>"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.remote_autostart=1
xdebug.profiler_enable_trigger=On