Debugging Netbeans Files

I have setup netbeans with xdebug so that it can debug php. However, this only works if I create a php project. This will not work if I try to open a separate php file. So my question is: is it possible to debug a separate php file that is not part of the phbe netbeans project?

If this is not possible, how can I debug standalone php files with netbeans?

+4
source share
5 answers

No, I don’t know anything.

As Myrddin said, the debugger needs some configurations that are part of the netbeans project.

but the best way to debug a single file is to copy it to the project folder and click on the debug project, as soon as the debugging session is established, you can view the PHP file you want to debug, and in fact it will go through xdebug.

Good luck

+2
source

Each project can have its own configuration (you can have 1 project with a PHP5.4 interpreter, one of them is PHP5.6, one of which is a command line, and the other is a web project), but if you configure general PHP 5 Interpreter: PHP Interpreter

If you are running on a Windows machine, you can use this code (php.cmd file name)

set XDEBUG_CONFIG="idekey=netbeans-xdebug" @php.exe %* 

If you want to debug, your interpreter must have the XDEBUG_CONFIG system variable and make sure that it is connected to netbeans. You must set this value in your Debbugging section in your PHP configuration: xdebug key

The next is that if you right-click in the editor, you will have the Debug File option and a prompt window will appear:

Run arguments You don't need anything here. Just click OK.

As you can see, this end result is a debugging session of the t1.php file in c:\TEMP\ (which is not a working draft):

debug session

+2
source

I'm not quite sure, but I think this is not possible because you need some kind of configuration for debugging to work, and this configuration is part of the project.

You can always use print_r and var_dump to debug a single file. But this is probably not the answer you are looking for.

+1
source

Short answer: CTRL + SHIFT + F5

Here you can find the answer: https://blogs.oracle.com/netbeansphp/entry/run_file_without_project

+1
source

xdebug is a very heavy and old tool in which you can use the Kint php debugger here.

free so you can download here

this is a nice replacement for var_dump (), print_r () and debug_backtrace ().

you need to add the kint.class.php file using the include or require function.

 require '/kint/Kint.class.php'; 

what he.

and you can use as

 ########## DUMP VARIABLE ########################### Kint::dump($GLOBALS, $_SERVER); // pass any number of parameters // or simply use d() as a shorthand: d($_SERVER); ########## DEBUG BACKTRACE ######################### Kint::trace(); more help is available on https://github.com/raveren/kint/ Good Luck :) 
0
source

All Articles