473,395 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to debug?

How can I debug a PHP program at all? Can/should I use a pop up a message on
the screen showing a variable? Or is there a better way of testing the code?

How can I pop up a message any way?

Thanks a lot
John

Oct 5 '05 #1
4 1731
John wrote:
How can I debug a PHP program at all? Can/should I use a pop up a message on
the screen showing a variable? Or is there a better way of testing the code?

How can I pop up a message any way?

Thanks a lot
John


You can't popup a message. PHP is server side and popups are client side.

You can echo (or print) variables. Or you can use an IDE such as the
ZEND debugger (expensive, but worth it if you do a lot of PHP).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Oct 6 '05 #2
Hi John

A couple of thoughts/options off the top of my head...

1) Use a high-end IDE like Zend Studio or ActiveState Komodo, which have
integrated debugging (my preference is Komodo)

2) Start developing using the Smarty templating engine,
http://smarty.php.net -- it has a debug setting that you can turn on and
off. When it's on, it will automatically generate JavaScript pop-up
windows showing variables

3) Start doing XP-style unit testing religiously. Several PHP folks were
inspired by Java's unit testing module, JUnit. Unfortunately this has
resulted in more than one project named PHPUnit (one of which is in PEAR
and distributed with PHP). IMHO, there is a better option, called
SimpleTest, which, contrary to it's name, has more of JUnit's feature-
set than either of the PHPUnits. And a great tutorial too.

http://www.lastcraft.com/simple_test.php
http://www.lastcraft.com/first_test_tutorial.php

It can be a bit confusing at first, but once you start unit testing,
your debugging sessions will be practically stress-free. I no longer
program without it.

Hope this helps,
GC
In article <vn*********************@news.xtra.co.nz>,
jo******@padasy.co.nz says...
How can I debug a PHP program at all? Can/should I use a pop up a message on
the screen showing a variable? Or is there a better way of testing the code?

How can I pop up a message any way?

Thanks a lot
John


Oct 6 '05 #3
John wrote:
How can I debug a PHP program at all? Can/should I use a pop up a message on
the screen showing a variable? Or is there a better way of testing the code?

How can I pop up a message any way?

Thanks a lot
John


There are quite a few PHP IDE/debuggers out there, from very basic ones
to very advanced. Some are even completely free.

check here: http://www.php-editors.com/result.php

..h
Oct 7 '05 #4
John,

If you use a lot of functions (like with OOP) you may like to print a
backtrace. For this you can write a simple error handling function, see
http://www.php.net/manual/en/functio...or-handler.php, that calls
debug_print_backtrace() (this function is php5 only, but it is also
available in http://pear.php.net/package/PHP_Compat ).

Greetings,

Henk Verhoeven,
www.phppeanuts.org (framework, includes error handler (prints a
backtrace) and unit testing tool)

John wrote:
How can I debug a PHP program at all? Can/should I use a pop up a message on
the screen showing a variable? Or is there a better way of testing the code?

How can I pop up a message any way?

Thanks a lot
John

Oct 7 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Davy | last post by:
Hi all, I use VC and gcc/gdb to compile and debug C/C++ files. But I found some of the debug version of the compiled files are too large to be run in a small RAM. Can I compile C/C++ Debug...
4
by: emma middlebrook | last post by:
I have a question regarding asserting ... here's some code: string GetAssertMessage() { ... prepare a message string and return it... } void SomeMethod() { ...
7
by: Srinivasa Rao | last post by:
I have read in one article that when we compile the application in release mode, all the debug classes and properties will be automatically removed from the code. I tried to implement this thing by...
9
by: dee | last post by:
Hi I'm about to upload my site and I have switched to release version. Is that enough or do I still need to disable <compilation defaultLanguage="vb" debug="true" /> the debug="true" in the .pdb...
6
by: swartzbill2000 | last post by:
Hello, I have a VB 2005 Express project with a TraceListener-derived class to route Debug.Print output to a log file. It works fine for Debug builds. What is the correct combination of changes to...
6
by: pauldepstein | last post by:
To help me debug, I am writing a lot of information into a stream which I call debug. However, because of the large amount of time taken to print this information, I only want this printed while...
6
by: Andrew Rowley | last post by:
I am having trouble getting debug and release builds to work properly with project references using C++ .NET and Visual Studio 2003. I created a test solution, with a basic Windows form C++...
0
by: BA | last post by:
I posted on this once before and could not get a solution, I am hoping someone can help. I have a very strange code debug behavior that I cannot make heads or tails of: I have c# code being...
1
by: gfergo | last post by:
Good Morning, I seem to be having a problem. I thought I could display detailed debugging information (including file name and line number) on a page using two different methods: 1.)...
3
by: rorni | last post by:
Hi, I'm porting code from Windows to HP-UX 11, compiling with g++. I'm getting a compilation error on the system's debug.h include file, which is included very indirectly through a series of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.