Saturday, October 09, 2010

XDebug using a Parallels VM and PHPStorm 1.0.2

I wanted to get XDebug working with my new IDE of choice: PHPStorm. I'm running a Parallels Virtual Machine (VM) with Ubuntu on it, and sharing my local folder on my Mac running Leopard.

I already had PHP 5.3.2, Apache 2.0 and mySQL running on the VM.

I installed XDebug using:
apt-get install php5-xdebug

This added a file named: "/usr/lib/php5/20090626+lfs/"

I then went in to /etc/php5/apache2/php.ini and added the following lines to the bottom:



Another time, I used this:



I also checked there was no zend lines referring to zend debuggers etc, which conflict.

The IP I used above was not the IP of the VM as reported when using ifconfig on the VM, it was instead the IP of my host machine (my mac):

ifconfig on my mac:

I added a file phpinfo.php with to see the xdebug settings:

I now needed to set up PHPStorm to use this configuration:

Under: Run > Edit Configurations in PHPStorm:

Clicking on Server path mappings:

Above, I made sure to use the mount point that the VM was using - this was configured using Parallels > Virtual Machine > Configure > Shared Folders options tab previously when setting up my VM.

I had mapped the /media/psf/ mapping to /var/www/ using a symlink. ( ln -s)

Here is the server configuration

and the mappings tab:

I made sure my VM Apache was restarted:
/etc/init.d/apache2 restart

Now to debug, I could click the Run > Debug option in PHPStorm.

I hope this helps someone. Any questions, please email nathan [ at ] eit dot co dot nz.

1 comment:

awais said...

thanks for sharing this blog...PhpStorm