Re: Debuggin PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2006-04-26 at 14:51, Sameer N Ingole wrote:
> Robert Cummings wrote:
> > On Wed, 2006-04-26 at 12:44, Jochem Maas wrote:
> >   
> >> hicham wrote:
> >>     
> >> easy way 2:
> >> 	use lots of echo()/var_dump()/print_r() in your code to figure out
> >> 	where it's breaking.
> >>     
> >
> > If you're trying to track down an error using this technique (by far one
> > of the most popular techniques and time tested), be sure and use your
> > knowledge of binary search algorithms to speed up your search. Applying
> > the heuristic of guessing approximately where it's occurring will help
> > you greatly also :) This kind of technique though is mostly only
> > necessary when PHP does something stupid like segfault *grin*.
> Most of the times it is true, however, sometimes everything just fails. 
> Apache continues to give segfaults on running a specific PHP script, 
> which do don't find until you look into error logs of apache. Then you 
> try to generate backtrace using gdb. All this while, on every try 
> Apache+PHP keeps crashing on you.
> 
> gdb backtrace too does not help much. So finally you compile bare bones 
> apache+php and Voila! Everything works just fine.. From there, you go on 
> adding one module per compilation to find the defaulter module and run 
> /that/ PHP script after every compile to see if it crashes. And after a 
> few compiles you find an Apache module to be a real culprit.

I use binary search for module seg faults also when the module is
unknown :) Also for segfaults, the error log (or just plain run from
CGI) can be handy to see your output before the crash.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux