NetBeans PHP and XDebug - jumping to methods on call stack? - php

I'm having trouble with debugging a PHP project through NetBeans using XDebug, and was hoping someone out there might have had this problem before.
Debugging works fine for the requested php file - so if I go to index.php on the remote server, I can put a breakpoint anywhere in index.php in NetBeans and the code stops there and I can step through.
The trouble is, all the other files appear on the call stack like this: "file:///home/user/site_html/library/class.requestprocessor.php" and because that's a path to a file on the remote server, NetBeans is unable to resolve the name, and so I can't step through the code for it. It makes debugging practically useless! The php file that was requested, for example index.php, appears just as "index.php", it's just all the other ones which are included that NetBeans can't resolve properly.
Is there some setting in NetBeans or XDebug that I can use to solve this problem? I have tried my best looking through all the project settings and options in NetBeans, and also looked through all the configuration options of the XDebug extention, but to no avail. Surely someone out there must have had this problem before? How did you solve it? I'll be very grateful if you could let me know.
If there's no other way, do users of Eclipse PDT and XDebug have this problem when debugging on a remote server? If not I'll make the switch.

This issue appears to be fixed in NetBeans 6.7.

Okay it seems no one is going to answer the question, so I'll post the results of my research.
As I was unable to find a way to make NetBeans successfully debug as I wanted, I tried using Eclipse PDT and Visual Studio 2008 with the VS.php extension in order to solve my problem. Eclipse PDT was hell to setup, and I wasn't happy with the way you couldn't specify a port to use for your FTP server in its Remote Server Explorer. I found VS.php did everything I wanted, it automatically uploads the code, as well as having perfect debugging, and it was EASY to setup. The only thing is, it looks ugly and I can't find a way to customise its colours. However, I'm going to choose function over fashion, and so I've settled on using VS.php as my final solution. Which to be honest is a shame, NetBeans was really great, I just can't live without a working debugger.

I had this same issue. I'm running Netbeans 6.8. You have to right click on your project, go to project properties/run configuration/advanced and set up path mapping. Map the folder on the server to a folder locally so that Netbeans knows which files to open locally when it hits these methods.

Related

Good PHP Ide for debugging Codeigniter?

I need a PHP ide for debugging my codeigniter website. I tried PhpStorm, Sublime, PhpEd and Netbeans with no success. Weird problems each time.
I just need an IDE to set a breakpoint and see the value of variables.
I'm tired of googling every day. Is there any stright forward way?
Thanks
Here is how to configure PhpStorm to use XAMPP as the web-server and how to install the debugger.
The first thing you need to do is to configure a debugger in your php.ini. Am currently using Xdebugger, if you use this one then just follow these easy instruction click here. Copy the info form php_info() and paste it into that white box. Then download the *.dll file they give you (for windows) and paste to the folder they ask you to.
The second thing you need to do is to configure the PHP interpreter. Follow the images.
Click on PHP and then the browse button in the interpreter section.
Click on the plus sign and then other local
Get the PHP home path e.g /xampp/php/
Then test it, you should be able to use with the browser and in the console (if your only doing stuff with PHP)
If you want to try something new, Try Cloud9.
Online IDE (I love this)
you can setup project from FTP
can sync with GitHub, BitBucket,
can debug/Run
I need https for some of my project testing, thats why I searched and found this.
hope this help.
I highly recommend Codelobster.
It has free PHP debugger and special plug-in for CodeIgniter autocomplete.

Komodo Edit, No PHP autocomplete and calltips with XAMPP

I got a real problem with Komodo Edit v8.5.3: I use XAMPP XAMPP v1.8.3 [PHP: 5.5.6] to provide a local hosted server for Komodo.
[Edit -> Preferences -> Languages -> PHP] ; here I configured the PHP stuff like this:
**Default PHP Interpreter** C:\xampp\php\php.exe
**Path to alternate PHP configuration file** C:\xampp\php\php.ini
**PHP Directories** nothing
After restarting I tested this feature: But no autocomplet and calltips, syntax checking did sometimes work ...
If I wrote some code, it began to scan the php directory of XAMPP for completing, but this search got freezed everytime somewhere (in the PEAR directory).
I don't really understand what's wrong with Komodo and XAMPP. (I did also reinstall Komodo.)
Komodo is great, but withoutd this the most importent feature is impossible.
Komodo php autocomplete didn't work for me, too.
My situation might be different, but I'm sharing for the next Googler to visit.
I installed Komodo before php5. Whoops. Installing php wasn't good enough, I had to also delete the config files in ~/.komodo-edit (or whatever folder it created).
That still wasn't enough, I also had to delete the ___.komodoproject file I was working on as well.
Then I was awed by Komodo's awesomeness.
Komodo Edit 8.5.3 has a memory leak problem. To confirm this check your process list and you will see Komodo Edit main thread and Python child thread. Watch to see the memory footprint of the Python thread as the scan progresses.
If the memory is large (for me is was over 1GB), try upgrading to a later release.
At time of writing this, you can find version 8.5.4 here:
http://downloads.activestate.com/Komodo/nightly/komodoide/latest/

JIT debugging PHP in Aptana Studio

Linux Mint 15, Aptana Studio 3.4.1, Chromium 28.0.1500.71
Sorry, this is a little lengthy to explain. Please let me know if something's not clear.
The title is my goal. I have a local server set up with Apache2. I don't know if it matters, but I have dnsmasq set up to redirect, for example, site.dev/index.html to /home/wastvedt/Projects/site/www/index.html (described here).
I've followed the tutorials I can find. XDebug is running, I have the helper installed in Chromium, and the debugger, interpreter, and web server set up in Aptana.
I'm working on a WordPress site and want to break on one of the functions in my theme's functions.php file. I created a breakpoint in the function in Aptana, turned on the XDebug helper in Chromium, and updated a post, which calls the function in question. Aptana recognizes what I'm doing and prompts me with the option of breaking on the first line. Regardless of what I select, I see "XDebug JIT Session [Remote Launch]" in the Debug view. The prompt appears three times, but nothing else happens in Aptana.
I think the problem might have something to do with linking files in the editor to files in Apache. When I try this JIT debugging thing with "localhost" (located at /home/wastvedt/apache2/www/index.php), Aptana brings up /home/wastvedt/Projects/site/www/index.php. This isn't right, but maybe the real problem is somewhere else. To be honest I'm a little lost now.
Any thoughts? I'd provide some sort of dump or output, but I'm not sure which or what.
Thanks for reading,
Trygve
In order to properly setup XDebug with Aptana I setup the below options by going to the Window menu -> Preferences -> Aptana Studio -> Editors -> PHP -> Debug:
Allow multiple debug sessions: Always
Break on first line when an unknown remote sessions (JIT): Never
Then click on XDebug in Installed Debuggers -> Configure:
Use Multisession: OFF
Accept remote session (JIT): any
That pretty much made it work for me.

Debugging with eclipse and xdebug won't go past the first line

Yes I have tried searching on StackOverflow and Google for my problem. If you read the entire question you will see that I include a lot of links to previous answers that I found using both.
I have been trying to get XDebug working with Version: Juno Service Release 2 of Eclipse for about the past hour and a half and I'm running into a log of issues. I've already solved most of my problems by using stack overflow and Google.
I followed the steps here first to install the debugger.
I made sure that I added the debugger as a zend_extension as mentioned in this post.
Here are the relevant lines from my php.ini file
zend_extension="/Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
xdebug.collect_params=4
xdebug.var_display_max_depth=999
xdebug.dump.POST=*
xdebug.dump.GET=*
xdebug.show_local_vars=1
I made sure that I edited the php.ini file for the 5.3 version of php that comes with MAMP. At this point the debugger would start even though XDebug does show up when I run php -v.
Since I was still having issues I checked the logs just like someone did here. I noticed this error in the logs:
PHP Fatal error: Class 'Model' not found in ...
After checking the documentation for the latest version of CodeIgniter I noticed that all Models have to extend CI_Model and not Model.
I fixed that and the error is no longer being printed to the logs, but now things just don't work. The debugger won't go past the first line when I try to debug a file.
I'm trying to debug my php application as a PHP CLI Application. When I try to debug the application as a PHP Web Application I get an error message that says:
No tab group defined for launch configuration type org.eclipse.php.debug.core.launching.webPageLaunch
After Googling the problem, I came across this post that suggested that you might not be able to do what I'm trying to do. Since the question was first asked in 2009, I decided to try the second suggestion and check for any updates.
After updating all of my Eclipse plugins I was still having the same problem. After searching on SO some more, I saw that this guy just gave up and tried with NetBeans and got everything to work.
Should I just consider the past 1.5 - 2 hours as a sunk cost and just move on to a different IDE?
I also had issues getting XDebug to work with Eclipse and XAMPP. In the end I decided to go with Netbeans and it was a lot smoother getting it setup. I am still using Netbeans to date for all of my PHP development.
Possibility your Php CLI is picking wrong php.ini file ?
Please go to terminal and check which ini file is loaded by :
php --ini
and make sure its desired one.
jerrod.taylor,
I had a lot of issues when starting use PHP,Xdebug and Eclipse. I considered change IDE myself but I liked the challenge and found a lot of help online. I will try to provide you with some tips will help you.
First of all this is the parameters I have in my php.ini:
zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
xdebug.remote_enable=On
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9060
xdebug.remote_handler="dbgp"
xdebug.remote_autostart=On
I am using local machine as remote host. Adapt for your world. This configuration works for me with CLI and Web debugging. I am really not sure if some of them is specific for different kinds of debug. So, lets start with all of them.
Now, make sure xdebug is been supported. Run the following command and see if exist something not good.
php -i|grep xdebug
NOw, lets go to Eclipse. In Eclipse preferences add the correspondent PHP executable and make sure the debuger type is Xdebug. This step can be done navigating through Preferences->PHP->PHP Executables. If you add an item, the form you ask you for the following information:
Name : Choose one
Executable Path : the_path_to_php_exe
PHP Ini file : you can leave it blank
SAPI type : CLI
PHP debugger : Xdebug
This step is important. It is how we will tell eclipse the executable to use.
Now, lets add a debug configuration. I have one project called upload in my workspace and exist a file index.php on this project. To create a debug configuration click in new when "PHP CLI Application" is selected. It will be add a new configuration form for you. For my Debug configuration I have the following information:
Tab PHP Script
Run Time PHP
Alternat PHP: (Select the PHP executable you have created above)
PHP File : /upload/index.php
Break Point : Break at first line is selected
This steps should be enough to you solve your issues. Let us know how it was.

Can't get PHP debugging to work with Komodo (but I'm almost there!)

I posted about this a week or so ago but since then I've done some further troubleshooting so I thought it was worth posting again:
I'm trying to set up PHP debugging in Komodo 7, using the Xdebug extension that ships with Komodo. The extension seems to be working fine, and Komodo responds when I try and start a debug session.
However, Komodo doesn't let me step-through my PHP code; instead it just runs through the code in a pane in the bottom-right of the Komodo window.
For the record, I don't have any Mapped URIs.
I'd really appreciate any help anyone's able to offer on this as I've got a website I need to debug for a great non-profit and this problem is preventing me from working.
Use the debugger connection preferences to change the port that Komodo listens to from the default value of 9000 to a system provided free port, 8080, or whatever port your remote host or localhost is running.
In the end I ran this past Activestate's tech support on IRC (#Komodo on irc.mozilla.org) who were really helpful. We couldn't work out what the problem was, though, so I ended up uninstalling XAMPP and Komodo, reinstalling both, and then following the instructions in the Komodo docs.

Categories