PHP debugging

Hi all,
having to debug a PHP web application using PHP 5 and Apache, can someone please suggest for a good way of debugging the application and, if possible, to embed some log/trace into the apache logs?

Thanks.
 
Debugging PHP can really be a pain in the ....
I have quite some PHP scripts partly copied from other sources and some developedmyself and when they finally worked: DO NOT TOUCH! anymore.
Well, I came to a point I did not have many options but to alter one of these NO TOUCH screens.
Of course after making the changes the script did not work anymore :(
Lucky for me I had learned a language called REBOL. I decided to rewrite my PHP code like it were a REBOL script using the REBOL indentation and breaking the script using what I had learned.
And guess what? Breaking up the script like this made it a whole lot more readable and almost by magic the errors I made showed up because there were things missing I expected there to be, like in the REBOL script there would be.

This experience made me cross out PHP experience from my resume, because the standards used everywhere in the industry are those of the unreadable undebuggable scripts I swore I never wanted to debug anymore.

Hope this helps a tiny bit,

Arnold
 
Arnold said:
Lucky for me I had learned a language called REBOL. I decided to rewrite my PHP code like it were a REBOL script using the REBOL indentation and breaking the script using what I had learned.

Well, if I could I would have already rewritten everything in Perl....but for a few projects I'm forced to use PHP.
The feel here is the same: PHP is a nice language but it does not scale very well, or at least, being difficult to debug and trace you have to setup a lot of unit testing and logging to be sure the code will work.
I believe this is one point that makes the difference between a language and a great language: the ease of adoption and its scalability.
Of course I'm not saying PHP is a bad language, it just do not work very well for me, but a lot of code has been PHP-powered.
 
PHP is a very easy language, thus xdebug is good enough. Furthermore, You can also use var_dump() to show variables.

At least, I write and debug PHP codes in this way.
 
Back
Top