Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XDebug configuration missing from php.ini in XAMPP

I've just installed the latest XAMPP for PHP 5.6 from the official website, and I need to enable Xdebug, I find that the file php_xdebug.dll exists in the C:\xampp\php\ext , but there is no [XDebug] config at all in the php.ini and I have no idea how to make it work. It should be installed by default and pre-configured, we need just to uncomment the xdebug config in php.ini but it's not the case. I even tried to install it again using PECL commmand pecl install xdebug but I get the following error :

pecl install xdebug
downloading xdebug-2.5.0.tgz ...
Starting to download xdebug-2.5.0.tgz (267,640 bytes)
.........done: 267,640 bytes
ERROR: failed to mkdir C:\php\pear\docs\xdebug\contrib

And in PHPStorm when I choose to add the interpreter by selecting the php.exe in the XAMPP directory, it says Debugger : Not installed too.

I re-installed XAMPP, but I still have the same problem. Thanks in advance.

like image 634
Dwix Avatar asked Dec 28 '16 20:12

Dwix


3 Answers

For more details, you can find a tutorial that explains step by step procedure php-debugging-with-xdebug-atom-and-xampp

As per this tutorial please follow these steps its works like a charm:

Steps to Install Xdebug:

  1. Download xdebug-2.4.0.tgz
  2. Unpack the downloaded file

    # navigate to the downloaded file
    $ cd ~/Downloads
    
    $ tar -xvzf xdebug-2.4.0.tgz
    $ cd xdebug-2.4.0
    
  3. run phpize

    $ phpize
    
    # example output
    Configuring for:
    PHP Api Version:         20131106
    Zend Module Api No:      20131226
    Zend Extension Api No:   220131226
    
    #Error possibilty
    Cannot find autoconf. Please check your autoconf installation and the
    $PHP_AUTOCONF environment variable. Then, rerun this script.
    
    #In the above error case you need to install autoconf using below command(MAC) and rerun phpize
    $ brew install autoconf
    

    The phpsize command is used to prepare the build environment for a PHP extension.

  4. Configure it by run:

    $ ./configure
    
  5. run make

    $ make
    

A successful install will have created xdebug.so file.

Steps to Configure Xdebug:

A successful install will have created xdebug.so and put it into the PHP extensions directory.

  1. You must copy this file to XAMPP php extension directory for that run:-

    $ sudo cp modules/xdebug.so /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20160303
    
  2. Finally update /Applications/XAMPP/xamppfiles/etc/php.ini and add the following lines to it

    [Xdebug]
    zend_extension = /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so
    xdebug.remote_enable=1
    xdebug.remote_connect_back=On
    xdebug.remote_port="9000"
    xdebug.profiler_enable=0
    xdebug.remote_handler=dbgp
    xdebug.remote_mode=req
    xdebug.remote_autostart=true
    
  3. Restart Apache using XAMPP’s manager-osx

Congratz! You have completed!! To verify you successfully installed & configured XDebug, open the XAMPP phpinfo.php file in a web browser, for example, http://localhost/dashboard/phpinfo.php.

  • Search for XDebug section in PHPInfo details. If it exists, you successfully have done your installation OR
  • In another browser window or tab, open https://xdebug.org/wizard.php and copy the phpinfo.php page content in the first window or tab and paste it into the textbox on the xdebug.org page. Then submit for analysis, it will give a summary of your installation status.
like image 129
arunjos007 Avatar answered Oct 02 '22 17:10

arunjos007


Safest was is to use XDebug wizard that will give you step by step instructions on how to install on your own machine. Then update your php.ini (tune to your needs)

Note: Wizard will give you instructions for what SAPI it receives phpinfo() contents from. So if you fill CLI phpinfo() output you will get instructions for your PHP CLI. If you paste phpinfo() from a server page you will get instructions for that.

like image 38
Tomáš Fejfar Avatar answered Oct 02 '22 15:10

Tomáš Fejfar


First copy your phpinfor() content form. paste the [xdebug wizard][1] [1]: https://xdebug.org/wizard. then download the xdebug.dll. after that follow this steps

  • Remove the exists php_xdebug.dill and paste the xampp\php\ext\php_xdebug.dll

  • update the php.ini like this

    [Xdebug] zend_extension = "C:\xampp\php\ext\php_xdebug.dll" xdebug.remote_enable=1 debug.remote_autostart=true

like image 22
Prabodha Avatar answered Oct 02 '22 15:10

Prabodha