[PHP] Re: PHP debugger
Miles Thompson wrote: Suggestions will be most welcome. Also, I'm not married to this, so if anyone thinks there is a better debugger, please jump in. The following assumes object-oriented programming paradigms are at least somewhat applied. I would guess functional would be similar, but procedural code, you might be on your own there... I actually use two classes that I include at the bottom of all of my library definitions (in if(!class_exists()){declare}format). One provides warning and error message storage, the other type assertion. Between the two of these, I have simple unit testing that I can perform as I am developing a class, as well as pre-included simple error logging that, when I install into the greater system, can be incorporated into the systemic error catching routines without refactoring code, in most cases to weld-on systemic error routines. Thinking aloud, getting code to work correctly usually means testing it against what you expect it to do, so doing that at a very localized level first can be helpful. Once I started doing this, my implementation issues somewhat went away. Results (and implementations) may very. PS Why are we doing this? Because we are getting tired of debugging with Javascript alert() boxes. /mt Firebug in Firefox is a very well-developed javascript debugger, featuring console.log(), which allows you to stop using alert() for error checking. Very nice! And I put this: code // Solve the firebug extension issue in IE by try/catching and creating a blank object console.log(); try{console.log();}catch(e){var console=new Object;console={log:function(){var k=0;}};}; /code At the head of each js file to prevent errors in IE or other browsers without Firebug installed. Example: http://web3.unt.edu/riskman/JS/lem.json.js -- Jared Farrish Intermediate Web Developer Denton, Tx Abraham Maslow: If the only tool you have is a hammer, you tend to see every problem as a nail. $$
[PHP] Re: PHP debugger
Currently I'm Using PDT/XDebug on daily basis and works just fine. You can get Xdebug from www.xdebug.org, PDT from www.eclipse.org/pdt and the plugin for PDT to add support to the PDT is https://bugs.eclipse.org/bugs/show_bug.cgi?id=169408 In the plugin precompiled package you'll find a pdf with instruction how to get things working. On the Xdebug site there's a lot of information how to setup PHP and XDebug. Note that the precompiled binary of the support for PDT will work for you, as it's written in Java and you don't need to compile it. Regards, Emil Ivanov Miles Thompson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I am trying to load a PHP debugger in our most recent build of PHP 5.2.1. The debugger which I am trying to set up is the free, pre-compiled Linux version of dbg ( DBG 2.15.5 dbg modules), from http://dd.cron.ru/dbg/, and all of the instructions have been followed as posted on the NuSphere site. Yes, Apache has been stopped and restarted!! There is no difference in the output from phpinfo(). The line with DBG v2.11.30, (C) 2000,2004 by Dmitri Dmitrienko, http://dd.cron.ru; does not appear. PHP is compiled without debugging, but I did consider that was for the purpose of debugging PHP itself, not scripts. Suggestions will be most welcome. Also, I'm not married to this, so if anyone thinks there is a better debugger, please jump in. Regards - Miles Thompson PS Why are we doing this? Because we are getting tired of debugging with Javascript alert() boxes. /mt PPS And we are using those because of Joomla! Some things are buried so deeply we cannot use print() or echo(). /mt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] debugger for CLI PHP scripts...?
On Thursday 12 May 2005 17:35, Christopher J. Bottaro wrote: Is there such a thing? Hi Christopher Spoken as someone who actively uses PHP both in webpages, and for scripts on CLI, the only debugger I am aware of is Gubed (but that's only for PHP Webbpages) Personally, I use the following setup (pseudo code, I could give you the actuall source code, but this is better because it will actually enhance your knowledge) This does not have breakpoints, but if you want them, you can write a function function breakpoint($info) {debug($info); die();} After that if you want conditional breakpoints, use an assert like function function assert($var,$value,$msg) {if($var==$value) breakpoint($msg); } Do you see the light yet? If you implement it properly, you don't even need to change your source code when debugging is done. example flow: Register_shutdownfunction(debug,dump); then everywhere in the script, function dosomething($param) {debug(domsomething($param)); ... } function debug() {static $data=''; get parameter list if first param=dump {if preferences=dumtofile writetofile $data else writetoconsole $data } else data[]=$parameters } } Can you see the use of this? Kind regards Andy -- Registered Linux User Number 379093 -- --BEGIN GEEK CODE BLOCK- Version: 3.1 GAT/O/E$ d-(---)+ s:(+): a--(-)? C$(+++) UL$ P-(+)++ L+++$ E---(-)@ W++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++) PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+) e$@ h++(*) r--++ y--() -- ---END GEEK CODE BLOCK-- -- Check out these few php utilities that I released under the GPL2 and that are meant for use with a php cli binary: http://www.vlaamse-kern.com/sas/ -- -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] debugger for CLI PHP scripts...?
On Thu, May 12, 2005 8:35 am, Christopher J. Bottaro said: Is there such a thing? You know, with single stepping, breakpoints, examining vars, etc. 100% of my PHP stuff is CLI (wacky, huh?) and I'd really benefit from a traditional debugger. Oh btw, I'm looking for a free/opensource one. I suspect the IDEs are tied into the web-server with --enable-debug... You *could* set up your dev box to run your CLI scripts through the web server, just for testing/debugging... The PHP GTK guys might have some insight on this one -- They do all CLI stuff with a butt-load of objects, so they must do *something* for those nasty objects, right? -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] debugger listener
Alberto M. wrote: php 4.3.0 + apache + linux suse 8.2 I tried to install xdebug (http://www.xdebug.org/install.php) as an precompiled module, but it seems not running when I did reload apache. I mean, I can't see it in the module list in phpinfo() page. Also, I don't know how to catch up events sent by debugger, may I need to build a tcp listener? Any hint about how to do it? Bye, Alberto. as usual, I answer myself: http://www.xdebug.org/docs-settings.php there are several options to set in php.ini file in order to get the xdebug work. BTW I would know if someone has tried xdebug and has some hints. bye, alberto. -- Imagination is more important than knowledge -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] debugger
There are some IDE's that support debugging or you can just use the parser. It will tell you the problem and spit out a warning or error depending on how you have your php.ini set up. I usually have display_errors on so that I can use that as my debugger. Then when I go on a live server I have it turned off and I have errors being logged to a file. Debugger for poor developers... B i g D o g - Original Message - From: Anil Garg [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, June 26, 2002 2:47 PM Subject: [PHP] debugger hi, in perl i used perldb for debugging. whats to be used in php!! thanx anil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] debugger
hi thanx for ur mail. In fact i have to make changes in the code written by someone else. I want to use debugger to know the path in which the files are called. Which is the debugger for php? thanx anil - Original Message - From: B i g D o g [EMAIL PROTECTED] To: Anil Garg [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, June 26, 2002 5:54 PM Subject: Re: [PHP] debugger There are some IDE's that support debugging or you can just use the parser. It will tell you the problem and spit out a warning or error depending on how you have your php.ini set up. I usually have display_errors on so that I can use that as my debugger. Then when I go on a live server I have it turned off and I have errors being logged to a file. Debugger for poor developers... B i g D o g - Original Message - From: Anil Garg [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, June 26, 2002 2:47 PM Subject: [PHP] debugger hi, in perl i used perldb for debugging. whats to be used in php!! thanx anil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] debugger
At 20.04.2002 21:15, you wrote: Hi to all!!! Can anyone tell me how to debug in PHP? When I use ASP simply I write stop (VB) or debugger (JSCRIPT) to set a breakpoint and open the Microsoft Script Debugger. With PHP I can't find a way to do a similar thing. I downloaded the DBG PHP debugger but I don't understand how to use it like MSD. My config is: PHP 4.1.2 + IIS5 + WinXPpro I'm bored to use echo $something for debug :-( Thanks in advance for your help, Evan I´m not shure, but ZEND offers some kind of IDE and nusphere has an IDE which has a debugger built in , but who needs this?? Use an editor with macro functionality so u can set a macro which makes something like if($debug){ echo something}, then you can set one var to turn debugging on/off. Are you shure you need PHP for your problems? Seems that you´re lucky with M$ and their ek$pen$ive environments. Oliver -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Debugger, Debugger and Debugger
On Thu, Feb 15, 2001 at 04:22:04PM -0500, Toby Butzon wrote: I've read that several times... so does that mean now the only debugger for PHP4 is the Zend one? there's http://dd.cron.ru -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Debugger, Debugger and Debugger
You must be viewing old documentation. http://php.net/manual/en/debugger.php clearly states that debugger, ie debugger_on() support is in php3 only, not in php4. Your not out of luck though, you could still use the Zend Debugger, the Zend boys seem to be quite eager to improve its current quallity. http://zend.com/store/products/ide-test-drive.php -- Chris Lee Mediawaveonline.com em. [EMAIL PROTECTED] ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 "Ricardo D'Aguiar" [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi, Problem: I'm trying put to work the debugger in php4.0.4pl1(Red Hat Distribution), I change my php.ini file to enable the debugger but when try to use in a simple script I get the following error: Fatal error: Call to undefined function: debugger_on() in /var/www/html/php/dbg.php on line 2 Questions: 1º Do I need some sort of extension (something like xxx.so) to activate the debugger? 2º In php documentation (Chapter: Using the Debugger) says: Set up a TCP listener on that port somewhere (for example socket -l -s 1400 on UNIX). I don't have that "socket" command in Linux/Unix, what is this? What this means? 3º I need to debug my script what is the best way to do that? (I tried the "Zend IDE Test Drive" but after 30 days is not for free and can't put to work the "The DBG PHP Debugger"). 4º What is the difference between Zend debugger, Dmitri Dmitrienko PHP debugger (seen link below) and the 'internal' PHP debugger? Thanks, (Sorry for the bad english) Additional Information: PHP version: PHP Version 4.0.4pl1- Red Hat distribution O.S. - Red Hat 7.0 Compiled options (PHP) extract from phpinfo(): './configure' '--prefix=/usr' '--with-config-file-path=/etc' '--disable-debug' '--enable-pic' '--enable-shared' '--enable-inline-optimization' '--with-apxs=/usr/sbin/apxs' '--with-exec-dir=/usr/bin' '--with-regex=system' '--with-gettext' '--with-gd' '--with-jpeg-dir=/usr' '--with-png' '--with-zlib' '--with-db2' '--with-db3' '--with-gdbm' '--enable-debugger' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' '--enable-yp' '--enable-ftp' '--enable-wddx' '--without-mysql' '--without-oracle' '--without-oci8' '--with-xml' Simple Script to test the debugger: ?php debugger_on(localhost); $var = 1; if ($var == 1 ) { echo "VAR is 1"; } else { echo "VAR is not 1"; } ? PHP.INI file (Revelant parts): #Extension actived extension=imap.so extension=ldap.so extension=pgsql.so [Debugger] debugger.host = localhost debugger.port = 7869 debugger.enabled= true Dmitri Dmitrienko PHP Debugger: http://dd.cron.ru/dbg/ +++ Ricardo D'Aguiar MemoSis - Sistemas Informáticos Portugal +++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]