473,765 Members | 2,057 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1756
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*******@attgl obal.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_bac ktrace() (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
2698
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 partially? Something like: fileA.c fileB.c And I can compile fileA.c with debug info and compile fileB.c without debug info?
4
4530
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
2914
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 using the following code in Page_Load event handler. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim intcount As Integer intcount = 0 For intcount = 0 To 4
9
1999
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 file? Is the .pdb necessary for the release version? Thanks a bunch. Dara
6
4120
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 make it work in Release build? Bill
6
3665
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 I am in debugging mode as indicated by a preprocessor directive: #define DEBUG In other words, I need code which says "Whenever I write debug <<
6
9142
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++ project. I then add a class library, and add a reference to this project in the first project. When I do a release build, I see the following in the output from the DLL compile: /OUT:"C:\Documents and Settings\Andrew\My Documents\Visual Studio
0
1800
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 executed in BizTalk assemblies which is repeating debug statements. I tried debug.flush() and debug.close() which did not solve the problem. In my BizTalk process I call a static method:
1
1718
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.) modify the debug attribute of the compilation element in the web.config file -
3
3271
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 other system include files. The one I am including is <map> . The errors I am getting are: /opt/hp-gcc-4.2.1/lib/gcc/ia64-hp-hpux11.23/4.2.1/../../../../include/c++/4.2.1/debug/debug.h: At global scope:...
0
9568
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9835
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8833
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7379
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5277
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.