Sometimes we don’t need an IDE to develop some simple projects. So many people use basic editors like notepad++ under windows. Surprisingly, they are able to debug your PHP scripts. With the help of plugins. Here is the tutorial.
1. you need to install notepad++. If you don’t have it installed, of course. It’s homepage is https://notepad-plus.sourceforge.net/uk/site.htm, here is the direct link to executablehttps://downloads.sourceforge.net/project/notepad-plus/notepad%2B%2B%20releases%20binary/npp%205.6.8%20bin/npp.5.6.8.Installer.exe?use_mirror=surfnet.
2. go to xdebug downloads page https://xdebug.org/download.php and download the version you need. For PHP 5.2.x you need <= 2.1.0beta3, for 5.3 - 2.1.0rc1 - see the filenames in URL. Place the downloaded file in your php extensions directory and open php.ini. Add the following line to the very end of the file (actually, doesn't matter where you place it):
zend_extension_ts="c:\php\ext\php_xdebug-2.0.5-5.2.dll" ;; ^^^^^^^^^^ change the path as in your system
I’d recommend you to put this and some other config properties under [xdebug] section:
[xdebug] zend_extension_ts="c:\php\ext\php_xdebug-2.0.5-5.2.dll" ;; ^^^^^^^^^^ change the path as in your system xdebug.remote_enable=1 xdebug.remote_handler=dbgp xdebug.remote_host=127.0.0.1 xdebug.remote_mode=req xdebug.idekey=default ;xdebug.remote_log="C:/tmp/xdebug.log" xdebug.remote_port=9000 xdebug.show_exception_trace=0 xdebug.show_local_vars=9 xdebug.show_mem_delta=0 xdebug.trace_format=0
Restart your web server, navigate to a file with phpinfo(); call and make sure if xdebug section is there. If it is not, go to step 2 and make sure you downloaded the version compatible with your php distribution and check the path to the .dll
3. Now we need DBGp notepad++ plugin. Here is its sf.net page: https://sourceforge.net/projects/npp-plugins/files/DBGP%20Plugin/ NOTE: I tried the latest version and it didn’t work with notepad++ 5.6.6, so I downloaded „DBGP Plugin v0.10 beta“ – it worked for me. The installation is much easier than the one of xdebug – just copy the .dll to notepad++ plugins folder and restart the editor.
4. DBGp configuration. Launch notepad++, proceed to Plugins -> DBGp -> Config. You should see something like:
where Remote Server IP (is the ip of the server where your sources are, in my case it is 127.0.0.1), leave IDE KEY empty for now. This is the value of the GET parameter ?XDEBUG_SESSION_START=session_name if you want to start debug session explicitly. The other two fields are local and remote source folders. If you’re debugging locally, set both to the directory where your sources are. Check the first two options, this will refresh the variables watchlist on each step
5. Plugins -> DBGp -> Debugger You should see the debugger. Click on a red button to toggle a breakpoint. Refresh the page in your browser. If nothing happens with notepad++ and DBGp , try to append ?XDEBUG_SESSION_START=session_name to the address. You should see: