zend debug multiple pages - php

I have a pretty simple setup:
Apache server, PHP 5.3, Eclipse, PHP Zend Debug Module
When I click on debug it sees my breakpoints and everything works fine. But only for the first page. If I click on a different page within the integrated browser, all breakpoints from that moment forward are ignored. I think it has to do with the fact that the first page's URL is something similar to
http://localhost/schedule?start_debug=1&debug_host=127.0.0.1&send_sess_end=1&debug_session_id=1003&original_url=http%3A%2F%2Flocalhost%2Fschedule&debug_start_session=1&debug_no_cache=1303403971996&debug_port=10000
Whereas pages after do not have these URL debug parameters appended. Is this a limitation with debugging in eclipse, or is there some way to append these GET parameters to every link I click? Perhaps a browser extension?
Looking under advanced for my debug configuration, I see that I have "Debug All Pages" checked.

I recently tried the Xdebug extension for the same thing, and i can really recommend it.
Xdebug does exactly this, and also sets a Cookie which contains the debug session info, so you can browse through the Website and the debugger will halt on a breakpoint. So it's definately not an eclipse issue.
You could check if the Zend Debug Module does the same thing by calling the above URL in Firefox and checking if a cookie was set.
Greetings and Good Luck

Related

Eclipse PHP debugging only works on first page (doesn't follow links)

I am having trouble getting PHP web debugging setup in Eclipse. I am able to step through the code on the main page http://localhost/app/index.php.
But as soon as I navigate to another page within this same app (being routed through index.php) the debug in Eclipse no longer picks up any of the routing (just shows as <terminated, exit value: 0>http://localhost/app/index.php).
In the past (6-8 months ago), I had this working with the same versions of Eclipse, PHP, XAMPP, Zend debugger, etc. I even made notes on how everything was setup, but for the life of me I cannot get it work again.
I do notice that the debug_host, start_debug, debug_port and other debug related URL params go away as soon as I navigate away from the original page. In some cases, I can copy and paste them onto the end of the new URL and it will send that page through the debugger, but this time none of the Ajax calls hit the debugger.
I have Googled to my heart's content with no luck, so any insight into what I may be doing wrong is greatly appreciated.
Just wanted to follow up on this in case someone comes across it via a search.
I'm not sure of the actual reason that the Debug all pages option doesn't work, but by selecting Start Debug from, entering the URL to my index page, and then checking Continue Debug from This Page seemed to solve my problem.

PHP XDebug disable breaking on each request

I'm writing a webapplication that uses JS and PHP. Each time I refresh I get about 5 ajax calls to my php script. This is getting quite annoying using XDebug since it breaks on each of those request (without a breakpoint placed).
I thought this was a common problem but I can't seem to find anyting about it. Does anyone know how to disable breaking on each request?
EDIT: I'm using Wamp and Netbeans 7.0
Rob
It's the IDE the one that's stopping. In NetBeans, go to Tool-> Options-> PHP-> Debugging and uncheck Stop at first line.
(In earlier NetBeans versions the option was under Tool-> Options-> PHP-> General)
From what i remember, xdebug adds something like XDEBUG_SESS_ID=xxxxxxxx to the url when debugging. if this is the case, then remove that from the url.
What is most likely that you have some empty src="" tags or alike. You need to find out what (by checking your apache logs) which requests are made. Xdebug itself does not decide to make requests.

Browser won't display new html code/links from Netbeans when developing in PHP

Developing with Netbeans 6.9.1
Using Firefox/Safari
Using MAMP Server
When developing a PHP application through Netbeans I find that most of my changes will show up in the browser when I Test Run my code. Little things such as links I do or css changes are lost or are not carried over in the browser test even though I can refer back to the line of code and note that what has been displayed is not my code. I am using Firebug so I can definitely know that links or styles are not being carried over into the test run.
How do I fix the problem to make sure I can accurately test my developments?
As mentioned by Thilo, this sounds like a browser caching issue.
I use a Firefox plugin called Web Devoloper, this has an option to simply disable/enable your browsers cache in a drop down menu. It also has many other features that you would find useful too.

How to do Debugging of PHP?

how we do basic debugging in PHP ?
Can anybody share true horror story on debugging PHP application (or (even better) on PHP framework such Codeigniter and Wordpress) ?
i love to hear real experience in case i have to encounter similar situation on my journey to learn PHP.
XDebug may be used to debug a PHP application. Basically you install this on your server and configure it in PHP.ini. Then on your desktop machine, you can setup Netbeans (and maybe Eclipse, but I have not tried that) to remote debug. When you are in a remote debug session you can do any of the things you typically expect: set breakpoints, step through code, etc.
One major annoyance when using CodeIgniter with mod_rewrite is that the debugger gets confused by index.php not showing up in the URL. I am not sure if this is a problem on the client side or server, and whether CI "eating" the GET portion of a URL has anything to do with it. In any case, I have worked through it by copying a 'debug.php' file to the server and starting debugging with that file - everything seems to work fine after that.
I any case, I highly recommend you get setup with XDebug at some point. You may not use it everyday, but when you need it you'll be thankful you did your homework ahead of time.
Easiest option (without installing any IDE) is to use firefox FirePHP addon.
Download and install FirePHP firefox addon
Download FirePHP core library from their website
Extract FirePHP library you downloaded in step 2 and only copy FirePHP.class.php to CodeIgniter /application/libraries/ folder, but give it a name FirePHP.php without the class part
Turn PHP’s output buffering on
Start your Firefox, click the FireBug icon on the bottom lower area, or go to menu and select tools. After you turn on (set them to enable) FireBug and FirePHP, be sure to click on the Net tab next in line to HTML, CSS, Script, DOM and set it also to enable.
See this link for how to use firephp library: http://speedtech.it/2009/05/debugging-a-codeigniter-application-with-firephp/
There is one problem in using IDE debugers - it's bad for debuging AJAX applications. In this case you will need to use some of browser extension. For FireFox it's FirePHP, and gor Google Chrome it's Php console.
I checked out a lot of debuggers 2 years ago when I wanted to set up a debugging environment for myself in PHP. I posted a brief post on this, you can go through it http://forums.codewalkers.com/general-chat-93/which-php-ide-to-use-840352.html
Bottomline was that Nusphere's phped was the best and its debugbreak() function makes debugging a real bliss. With codeigniter also this works fine, no tweaks required if you have already enabled get variable. The only hiccup with codeigniter+phed is that, you cannot do code navigation like "right click and find declaration" for other files models.
Off late I have been checking out codelobster they have a codeigniter plugin, but I am not through with it yet.

REMOTELY Debugging PHP Using Eclipse

I'm a self-taught noobie, trying to debug PHP on my GoDaddy hosted server. Is this idea even rational, or do I need to continue to do all development locally and just continuously re-ftp upload the changes?
Is there some way that I can use eclipse to step through, and debug my php scripts that are hosted on a third party site?
Although I have only used Netbeans and XDebug for remote debugging, it should be possible to use Eclipse PDT and XDebug. See:
setting-eclipse-pdt-and-xdebug
Debugging PHP applications with xdebug
One caveat, however. To configure xdebug you will need to modify some settings in php.ini - I am not sure if this will be possible on a hosted server. If not, you would need to have a local server that you use for debugging, and would need to figure out another solution for your "production" environment. Which may not be a bad idea, actually, as it would give you a good place to test your changes without risking breaking anything on your actual site.
Also, I recommend that you look into Netbeans, if for no other reason than to experiment and see what it can do compared to Eclipse. One nice feature is that you can set it up to automatically ftp (or scp) changed files to the remote site. So you can make some code changes, click the debug button, and after waiting a moment for your files to upload you can be stepping through code on the remote site.
While there is definitely a case for remote debugging you should always be working locally and then uploading. Anything except the most minor of changes should be done locally tested then pushed to a server - sometimes production directly, sometimes a testing server...
Yes Eclipse supports remote debugging with Xdebug as well as the one from Zend Debugger check out Justin's links as well as This one for Zend Debugger. I think Zend has an all in one with pdt+deps and Zend Debugger - ofcourse you still need to set up the extension on the server (note link is for setup on windows but hte process should be similar).
Obligatory "Ewww GoDaddy" :-)
If the web server have XDebug installed, then you can do debugging with it. Searching for it in google yield a quite num of articles on how to do it.
Personally, I'm using CodeIgniter. I do debugging using FirePHP and PQP. Make a habit to write a good indented code. You might find your code have less bug, both syntax and logic, and easier to maintained in the future. Use a consistent white space, either tab or space. Use a consistent bracket style. It will save you from the headache when re-read it for bug or adding more feature later.
I have never needed to do a step by step debug in PHP, but when I do need to debug I just output strings of the variables at that point.
However, one thing that I found, but again never used, was FirePHP:
http://www.firephp.org/
As far as I'm aware, this is not possible in Eclipse, it is, however, possible in NetBeans, but as Nathan stated, I've never really needed to remote debug any of my PHP scripts.

Categories