How to enable xdebug in xampp?

enabling Xdebug in PHP eclipse

How to enable xdebug in xampp ?

If you are running your PHP or PHP/MySQL project using XAMPP then enabling xdebug will be very easy, since xdebug will be already included in the xdebug.

We just have to enable xdebug in php.ini to start debugging.

 

open the php.ini file which will exist in this location,

 

C:\xampp\php

 

Note: File location may vary based on your xampp path.

 

enabling Xdebug in PHP eclipse

 

 

php.ini file:

uncomment the below two lines,

zend_extension = “C:\xampp\php\ext\php_eaccelerator.dll”

 

zend_extension = “C:\xampp\php\ext\php_xdebug.dll”

 

 

The above lines will exist already in the php.ini file, you have to just uncomment it, if you could not find then after ensuring that xdebug in xampp is exist already, you can simply add the above two lines to your php.ini file.

 

It is recommended to add the below line too to enable the xdebug in xampp php projects,

xdebug.remote_enable = 1

 

 

How to confirm whether xdebug is enabled or not in php.ini ?

 

Create a file named info.php in htdocs folder which exist in the xampp folder and put only the below line,

Full path: C:\xampp\php\info.php

 

[php]

<?php phpinfo(); ?>

[/php]

 

After you put the above lines, just run

http://localhost/info.php

and try to find the xdebug(Ctrl+F and type xdebug), if you would have enabled it correctly then you can see xdebug terms in the output. If you could not find it, ensure you have done the things properly as mentioned here.

Note: Ensure you have your (apache)server in start mode. [Check at Xampp\xampp-control.exe application]

 

 

Generally when you are debugging any program we will have to keep the breakpoint then we have to keep the server in debug mode, then when you run the program it will stop at the breakpoint.

 

But here you need to run like this,

 

http://localhost/mysite/?XDEBUG_SESSION_START=mysite

 

If you run the localhost site only in the above way then only debugging will be enabled in the xdebug and also it will always start the debug from the first line of the program execution rather than only the breakpoint places.

 

Note: Debugging will happen if you open phpmyadmin also, so use xdebug appropriately.

 

Still could not get it working, you can post your queries in the below comments section to help you out.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Leave a Reply