• Hey Guest!
    British Car Forum has been supporting enthusiasts for over 25 years by providing a great place to share our love for British cars. You can support our efforts by upgrading your membership for less than the dues of most car clubs. There are some perks with a member upgrade!

    **Upgrade Now**
    (PS: Upgraded members don't see this banner, nor will you see the Google ads that appear on the site.)
Tips
Tips

php debugging - uck

G

Guest

Guest
Guest
Offline
i've just spent the last two hours debugging a custom php script.
there has to be a better way to do this than just spattering the code with "echo" everywhere to try to trace the program logic.
i just need to find it!

it's a good job i'm better with the stuff i actually get *paid* for /bcforum/images/%%GRAEMLIN_URL%%/laugh.gif
 
I am paid to do the PHP thing, and that's really the way you go through it (same as with any language, really). A handy function is:

<div class="ubbcode-block"><div class="ubbcode-header">Code:</div><div class="ubbcode-body ubbcode-pre" style="height: 34px;"><pre>var_dump(item1 [, item2, ...])</pre>[/QUOTE]

which outputs whatever variable or string (or list of the same). Handy for seeing where a program is, or what values are at a particular point. With classes I use all the time, I add debugging code that can be turned on with a simple flag when needed.
 
Geez, Drew! My Linux box just ~MOANED~ when I open'd this thread! /bcforum/images/%%GRAEMLIN_URL%%/jester.gif

drooartz said:
With classes I use all the time, I add debugging code that can be turned on with a simple flag when needed.

Clever lad.

PHP eludes me. I'll keep it that way as long as I can hold out.
 
Its embarrasingly easy - but then I mostly do assembler for a living so I would say that...

The debugging facilities leave something to be desired though. I'm used to being able to single step in any other HLL and it's odd to go back to the equivalent of printfs.

That said, I've just started writing shell scripts in Linux. They are nearly as bad...
 
Assembler was my bane. Hat's off, dude.

Linux shell... Back to Basic(s) in large part.

BASH!

/bcforum/images/%%GRAEMLIN_URL%%/devilgrin.gif
 
I learned a bit of assembly while in college... thought it kinda fun mainly because i got to see the results of my labor in lab right away.

PHP isn't too hard, but as has been said already, debugging your code the way you're doing it is the only way. The only diff between doing it this way and via a dev environment is you don't get the pretty GUI debugger to help you step through code.

All the Java and C I learned in college feels like it's atrophying away (if it isn't completely gone already). The only programming I do now days is fiddling with InstallShield Script code. Oh, and futzing around with PHP when I get a hair up my backside.
 
Count your lucky stars.
Imagine what it would be like if you had to do it for a living...
 
I opted for a MUCH simpler scheme: Stuff Linux file servers in place!
 
Rob said:
All the Java and C I learned in college feels like it's atrophying away (if it isn't completely gone already). The only programming I do now days is fiddling with InstallShield Script code. Oh, and futzing around with PHP when I get a hair up my backside.

In COLLEGE!?! Java?!?!


....I had BOOKS and naught much else for Java. And Pearl... I ran.
 
I've spend the last month debugging massive PL/SQL programs. Yuck!
 
Have you lookes at Firebird? Old Borland SQL. DBM gone "free range". /bcforum/images/%%GRAEMLIN_URL%%/wink.gif
 
doc, i also didnt understand a darn thing you guys were talking about but what i do know is that my 7 year old "dell" is just about ready to take a flying lesson out my office window it needs replacing i use it just for basic stuff but would like to upgrade with better music and dvd burning programs any suggs. about what to replace it with? for about $450.00 "dell" has one with the stuff im looking for i dont mind spending up to about $550.00 for something better, any brand any better? thanks. a7777 /bcforum/images/%%GRAEMLIN_URL%%/savewave.gif
 
Ant'ny, I'm not a big Dell champion, as part of my business is building machines to spec. They're hard to beat for price/parts in a preconfigured box, tho. If it will do the things you want it to, there's nothin' wrong with 'em.
 
As long as you back up regularly.

Let's say that on the last couple of desktops I bought from D*** my hard drives have had 'issues' - in every case within 3 months after the warranty expires, and leave it at that.

That said, the laptops have all worked fine. The salesmen that keep calling asking me to buy a $250 extended warranty on a $500 laptop are another issue entirely...
 
I've become a big fan of PHP over the last 4 years. I've written a helpdesk, web content management, employee data management, and quite a few other bits and bobs with it for my current employer (a school district). It's logical and uses a very C-like syntax which makes sense to my geek-brain. And of course, open source and free -- always helpful when working in public education!

I never cared much for doing direct memory management and garbage collection. That's what computers are for, to do the dirty behind-the-scenes work! (Spoken like a true scripter who also does a bit of Perl and shell scripting...)

I do marvel, though, that I can earn a decent living doing something that didn't exist when I was in college in the early 90s, which really wasn't that long ago.
 
DrEntropy said:
Rob said:
All the Java and C I learned in college feels like it's atrophying away (if it isn't completely gone already). The only programming I do now days is fiddling with InstallShield Script code. Oh, and futzing around with PHP when I get a hair up my backside.

In COLLEGE!?! Java?!?!


....I had BOOKS and naught much else for Java. And Pearl... I ran.

yeah... I had to have a "Computers" elective, and the C Programming class from the Community College didn't count at the University. It weren't as easy as it may sound. By the time we got to the end of the semester we were making GUI apps from scratch...
 
Not intimating ~easy~ by any stretch. Me 'n code get on like a tiger an' a porkchop... ~I'm~ th' porkchop. /bcforum/images/%%GRAEMLIN_URL%%/wink.gif
 
I'm not very fond of programming either

always fancy myself as a hardware kinda guy

but I still have to pay the bills some how.
 
I usually like programming. I make an ok living from it so I'd better.

That said the inner join I'm trying to write right now to figure out what went wrong with a database I'm looking after is giving me fits. Bloody thing is taking forever to run.

The fact that I had to go on the internet to look up the correct syntax for an inner join of course gives me great confidence that I got it right. You can tell I do a lot of SQL in my daily routine...
 
Back
Top