Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: HOWTO: Install xdebug for PHP5

  1. #1
    Join Date
    Jul 2007
    Location
    Sweden
    Beans
    24

    HOWTO: Install xdebug for PHP5

    Here is a mini-howto in how to install the xdebug extension with PHP5 in Ubuntu 7.04

    This will install xdebug 2.0 (or whatever is latest version in PEAR repository when you try this).

    It is assumed you have Apache2 + PHP5 working already.

    Code:
    sudo apt-get install php5-dev php-pear
    Now install xdebug thru PECL.

    Code:
    sudo pecl install xdebug
    Now we need to find where xdebug.so went (the compiled module)

    Code:
    martin@martin-dev:/$ find / -name 'xdebug.so' 2> /dev/null
    /usr/lib/php5/20060613/xdebug.so
    Then edit php.ini:

    Code:
    sudo gedit /etc/php/apache2/php.ini
    Add the following line:

    Code:
    zend_extension="/usr/lib/php5/20060613/xdebug.so"
    Then restart apache for changes to take effect

    Code:
    sudo /etc/init.d/apache2 restart
    Check phpinfo() to make sure the extension is loaded correctly. The following line should have been appended to the copyright lines:

    with Xdebug v2.0.0, Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, by Derick Rethans

    For more information about xdebug configuration and usage, please read the official documentation, found here: http://xdebug.org/docs/

  2. #2
    Join Date
    Mar 2007
    Beans
    18
    Distro
    Ubuntu Jaunty Jackalope (testing)

    Re: HOWTO: Install xdebug for PHP5

    Thank you, thank you. That worked.

    Was trying to follow the instructions on the XDebug website, but couldn't get it to work!

  3. #3
    Join Date
    Aug 2007
    Beans
    10

    Re: HOWTO: Install xdebug for PHP5

    Hey dude, thanks for the guide, it saved me some time.

    For anyone else following this guide, I have one slight change I would recommend. Rather than including the xdebug.so extension in your php.ini file, it is probably more appropriate to create an ini file specifically for this extension in /etc/php5/conf.d/xdebug.ini. The file can be as simple as:

    ; xdebug debugger
    zend_extension="/usr/lib/php5/20060613/xdebug.so"

    And then to compliment this setup, add any xdebug configuration directives to this file as well.

    This has two benifits:

    1. It will be automatically included by both cli php5 and apache2 php5
    2. It will persist regardless of what happens with your php setup. If your main php.ini file gets changed or modified by some automated process, you don't risk losing your xdebug setup stuff.

    Laters

  4. #4
    Join Date
    Jul 2006
    Location
    Hertfordshire
    Beans
    454
    Distro
    Kubuntu 9.04 Jaunty Jackalope

    Re: HOWTO: Install xdebug for PHP5

    Quick and painless, thanks for the HOWTO!

  5. #5
    Join Date
    Aug 2008
    Beans
    1

    Smile Re: HOWTO: Install xdebug for PHP5

    Thanks much appreciated.

  6. #6
    Join Date
    Apr 2008
    Beans
    9

    Lightbulb Re: HOWTO: Install xdebug for PHP5

    Hi everyone,

    It's package that provide xdebug.

    Just type in console:
    Code:
    sudo aptitude install php5-xdebug
    --

    webik

  7. #7
    Join Date
    Jun 2007
    Beans
    1

    Re: HOWTO: Install xdebug for PHP5

    I'm with webik but I had to change a config file to get it to work properly on my debian box, pretty sure this will work the same on ubuntu though~

    Code:
    devtix:/# sudo apt-get install php5-xdebug
    Find path to xdebug:

    Code:
    devtix:/# find / -name 'xdebug.so'
    /usr/lib/php5/20060613+lfs/xdebug.so
    and load it as a zend extension in the /etc/php5/cli/conf.d/xdebug.ini generated by apt:

    Code:
    zend_extension="/usr/lib/php5/20060613+lfs/xdebug.so"
    Reload apache

    Code:
    sudo /etc/init.d/apache2 restart
    Test xdebug is loaded correctly with php -v

    Code:
    devtix:/# php -v
    PHP 5.2.8-0.dotdeb.1 with Suhosin-Patch 0.9.6.3 (cli) (built: Dec 11 2008 23:02:27)
    Copyright (c) 1997-2008 The PHP Group
    Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
        with Xdebug v2.0.3, Copyright (c) 2002-2007, by Derick Rethans

  8. #8
    Join Date
    Nov 2008
    Location
    Chennai
    Beans
    11
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: HOWTO: Install xdebug for PHP5

    nice info.. appreciated..!

  9. #9
    Join Date
    Jul 2006
    Location
    Hertfordshire
    Beans
    454
    Distro
    Kubuntu 9.04 Jaunty Jackalope

    Re: HOWTO: Install xdebug for PHP5

    Quote Originally Posted by webik View Post
    Hi everyone,

    It's package that provide xdebug.

    Just type in console:
    Code:
    sudo aptitude install php5-xdebug
    --

    webik
    php5-xdebug was only added to the repositories in late April 2008, after this thread was started.

    http://packages.ubuntu.com/search?ke...ll&section=all

    If you are using Ubuntu 8.04 or above, use the php5-xdebug package; otherwise follow the instructions in this post.

  10. #10
    Join Date
    Feb 2009
    Beans
    2

    Re: HOWTO: Install xdebug for PHP5

    Just one hint guys.

    It is not wired directly with installation of xdebug, but I faced it during installation process. Xdebug is creating in your browser cookie with session name. What happened to me ... This cookie was somehow broken (I can't reproduce what exactly went wrong) what caused that the script was started in debug mode each time even if it was not requested (doesn't matter if there was or wasn't XDEBUG_SESSION_START pushed to server with GET). In first moment I thought that the script freezes but it was just extremely slow. Execution of php scripts was that slow because first X seconds server tried to connect remote debug client on port XXXX where in fact nothing was listening as nobody requested debug mode. Solution however was very simple (unfortunately I spent some hours to figure it out), I just removed that cookie out of my browser. Since this action everything works fine and debug mode is initiated ONLY if I really want.

    Hope this save someone time .

    Regards,
    mOOnSPa

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •