Installing Xdebug (Ubuntu)

If you're not familiar with xdebug, here's a brief intro taken from the site:

The Xdebug extension helps you debugging your script by providing a lot of valuable debug information.
Execute this command in terminal:
sudo apt-get install php-dev php-pear && sudo pecl install xdebug

Then restart your web server: sudo /etc/init.d/apache2 restart (since I'm using Apache2)

Create a php file named phpinfo.php in the "Document Root" and add this line:

<?php
phpinfo();
?>

Update: For some reason I can't get it to work with vim yet. Huhu You can find the error message here. If you happen to know the solution, hope you can share it with me.

Anyways, according to the tutorial here, you need to download the vim script found in this link. After that extract the files to /.vim/plugin/. And to test it, open the php file in vim and press F5. Then quickly go to your browser and enter the URL path to your script with the suffix ?XDEBUG_SESSION_START=1. You can do this within only 5 seconds then it will "disconnect". And that's it.

0 comments: