Installation
It is definitelly worth to read oficial installation docs before proceeding, it's quite short and it can help to avoid basic mistakes that are sometimes recomended elsewhere. You don't have to read it all - just pick the part which you need - pecl - homebrew - from source.Installation of XDebug in Fedora is really simple as there is the newest version in Fedora repositories. We can simply use the pecl installation.
> sudo dnf install php-pecl-xdebug
XDebug Configuration
This type of installation already enables xdebug extension. At least in my case the file /etc/php.d/15-xdebug.ini was already there after installation.tomor-lenovo :: ~ » cat /etc/php.d/15-xdebug.ini ; Enable xdebug extension module zend_extension=xdebug.so ; see http://xdebug.org/docs/all_settings
Now add xdebug configuration into php.ini.
Official documentation with xdebug settings comes handy when you want to understand these options.
I've added lines lower to almost the end of my /etc/php.ini.
[xdebug] ;xdebug.remote_autostart=1 xdebug.remote_enable=1 xdebug.remote_handler=dbgp xdebug.remote_mode=req xdebug.remote_port=9000 xdebug.remote_host=127.0.0.1 ;xdebug.profiler_enable=1 xdebug.profiler_output_dir=~/tmp/ xdebug.idekey=netbeans-xdebug
Verify the confguration:
tomor-lenovo :: ~ » php -i | grep xdebug Additional .ini files parsed => /etc/php.d/15-xdebug.ini, xdebug xdebug support => enabled IDE Key => netbeans-xdebug xdebug.auto_trace => Off => Off xdebug.cli_color => 0 => 0 xdebug.collect_assignments => Off => Off ....many more...
You should see the values which you previously set in the php.ini.
The previous verification of configuration is just for php-cli - php scripts which you start from terminal.
To verify XDebug config for webserver you have to restart your http server first and then verify the xdebug settings via php file which executes phpinfo(); function.
Netbeans XDebug configuration
My Netbeans version: 8.1Check settings of php debugger in
Tools -> Options -> PHP -> Debugging tab
Values here must match values in php.ini - port, ide key.
I restarted Netbeans after changing the configuration, but I'm not sure if it's needed, probably not :)
Running - debbuging
I wanted to debug just one php file so it was easy.
At first I set one breakpoint by clicking to the left next to the code. And then simply via menu Debug -> Debug File
And now just use F7, F8 etc. and hover over variables to see their content.
That's it.
"Nice and good article.. it is very useful for me to learn and understand easily.. thanks for sharing your valuable information and time.. please keep updating.php jobs in hyderabad.
ReplyDelete"