FusionForge

Difference between revisions of "Debugging PHP over xdebug with Eclipse and Vagrant"

From FusionForge Wiki
Jump to: navigation, search
(Created page with "This documents the configuration needed to debug FusionForge PHP code under the Eclipse IDE (equipped with the [https://wiki.eclipse.org/PDT PDT PHP development environment]),...")
 
Line 18: Line 18:
 
  [... ./install.sh]
 
  [... ./install.sh]
 
This ensures that the PHP code will be extracted in a directory that gets created in the directory where <tt>vagrant up</tt> was performed on the host
 
This ensures that the PHP code will be extracted in a directory that gets created in the directory where <tt>vagrant up</tt> was performed on the host
 +
 +
== Configuring the PDT environment and VM to use XDebug ==
 +
 +
=== Configuring XDebug in the Vagrant VM ===
 +
Install <tt>php5-xdebug</tt> in the VM (via <tt>vagrant ssh</tt>)
 +
sudo aptitude install php5-xdebug
 +
 +
Activate the <tt>remote_connect_back</tt> option so that Eclipse can pilot XDebug
 +
sudo cat << EOF >> /etc/php5/conf.d/20-xdebug.ini
 +
xdebug.remote_enable=1
 +
xdebug.remote_connect_back = 1
 +
EOF
 +
 +
And restart Apache
 +
sudo apache2ctl restart

Revision as of 15:48, 10 February 2015

This documents the configuration needed to debug FusionForge PHP code under the Eclipse IDE (equipped with the PDT PHP development environment), while executing the code inside the Vagrant-based virtual machine development environment.

This requires :

  • sharing the source code between the host and guest
  • the activation of the XDebug PHP extension in the VM

Sharing the source code between the host and guest

This is needed so that modifications of the PHP code are instantaneously taken into account in the execution environment.

For this you may for instance add a shared directory in the Vagrantfile, by uncommenting the line :

#config.vm.synced_folder "../src", "/usr/share/gforge"

if you wish to execute the code present in the Git repo from where the vagrant up command is performed

Another option is to perform the following steps before installing the packages built inside the VM (refering to Building and installing FusionForge instructions) :

[... ./build.sh]
mkdir /vagrant/usr_share_gforge
ln -s /vagrant/usr_share_gforge /usr/share/gforge
[... ./install.sh]

This ensures that the PHP code will be extracted in a directory that gets created in the directory where vagrant up was performed on the host

Configuring the PDT environment and VM to use XDebug

Configuring XDebug in the Vagrant VM

Install php5-xdebug in the VM (via vagrant ssh)

sudo aptitude install php5-xdebug

Activate the remote_connect_back option so that Eclipse can pilot XDebug

sudo cat << EOF >> /etc/php5/conf.d/20-xdebug.ini
xdebug.remote_enable=1
xdebug.remote_connect_back = 1
EOF

And restart Apache

sudo apache2ctl restart