Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xdebug on XAMPP and Notepad++ won't connect

Tags:

php

xampp

xdebug

I have a really slow script from someone else that I need to profile to speed up, I have followed numerous tutorials however it keeps leading to the same step.

I have downloaded the appropriate binary from xDebug's site, by copying the phpinfo into Xdebug's website find_binary.php search functionality.

I have a seemingly correct setup.

Notepad++ (NPP) is configured to connect to Xdebug via 127.0.0.1:9000 with the specified IDE key.

The following is the section of php.ini specific to xdebug.

[xdebug]
zend_extension_ts="C:\xampp\php\ext\php_xdebug.dll"
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler=dbgp

I am using PHP 5.4.4.

My phpinfo output does not mention Xdebug.

like image 823
Shane Avatar asked Dec 21 '22 15:12

Shane


1 Answers

For windows with php5.3 and up you need to use zend_extension instead of zend_extension_ts in your php.ini file.

Example

zend_extension="C:\xampp\php\ext\php_xdebug.dll"

If you use the xdebug wizard http://xdebug.org/wizard.php and you get this message Xdebug is only loaded as PHP extension and not as a Zend Extension It is because of using zend_extension_ts (I think).

Another thing to note.

You won't see anything in notepad if you don't set breakpoints in the code you are testing. It will run so fast that it will seem like it is not working (if you watch carefully though, notepad plus will flash). Took me a long time to realize that.

Thirdly

I would recommend downloading the latest xdebug.dll for your system available from http://xdebug.org/download.php

xdebug has only been compatible with php 5.4 since [2012-05-08] - Xdebug 2.2.0 The latest version is Xdebug 2.2.1

I'd also recommend using the latest version of DBDG plugin (notepad plus requires this file to work with Xdebug) from http://sourceforge.net/projects/npp-plugins/files/DBGP%20Plugin/

ANOTHER THING

EDIT: Just noticed your using XAMPSERVER,but I'll leave it in case it is useful for someone else. If you are using wampserver 2.2, xdebug is preinstalled. This might be causing problems if you manually installed xdebug again later and manage to have 2 versions installed or something crazy like that.

My last working php.ini file for xdebug

Please note my last version was working, albeit very slowly. In the php.ini I have the ide set to xdebug, but I could call it any session name I wanted and it worked. You probably don't need all of the info I've posted below and you will most likely need to change the file path and file name. I was using D drive.

[xdebug]

;for windows with php5.3 and up you need to use zend_extension instead of zend_extension_ts
zend_extension="D:\wamp\bin\php\php5.4.3\ext\php_xdebug-2.2.1-5.4-vc9-x86_64.dll"
xdebug.remote_autostart=on
xdebug.profiler_output_dir = "d:/wamp/tmp/xdebug"
xdebug.profiler_output_name = "cachegrind.out.%p"
xdebug.profiler_enable = 1
xdebug.profiler_append=0
xdebug.extended_info=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.idekey=xdebug
xdebug.remote_log="d:/wamp/tmp/xdebug/xdebug_remot.log"
xdebug.show_exception_trace=On
xdebug.show_local_vars=9
xdebug.show_mem_delta=0
xdebug.trace_format=0

enter image description here

LASTLY

Don't forget to use ?XDEBUG_SESSION_START=sessionname at the end of the url address of the code you wish to test.

EXAMPLE

http://localhost/codetotest.php?XDEBUG_SESSION_START=xdebug

Also restart your server's services after making any changes else they won't take effect.

like image 172
TryHarder Avatar answered Dec 28 '22 08:12

TryHarder