Posts Tagged ‘sockets’

With our last article on debugging PHP with UDP sockets we created a new class able to send debugging information from PHP to a remote netcat client. The limit of the code was that it could only send strings and not arrays or an object. Today we will modify the code to send arrays to our remote listening client.

First, I will show you what happens if we try to send an array using the UDPDEBUG class that we currently have. To do this we will create a very simple array and then attempt to send it.

 php (udptest2.phps) download
<?
	$ThisWeek = array(1 => 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday',  'Saturday', 'Sunday');

	require_once("UDPDEBUG_CLASS.php");
	$UDPDEBUG = new UDPDEBUG("127.0.0.1", 4545);
	$UDPDEBUG->SEND($ThisWeek, 'LOW', TRUE);
?>

    

This test code results in no useful information other then the fact we are dealing with an array.

Read the rest of this entry »

Technorati Tags: , , , , , ,

The nature of Internet applications creates an issue with debugging. For example, how do you debug an application that may be getting hundreds or even thousands of hits every minute? How do you debug this application without sending sensitive data to the user in the form of comments or debug statements that are “hidden” for only as long as nobody is looking for them? What do you do when you are unable to trigger an error but your user base is, though they lack the knowledge to be of much assistance other then “I borked it!”?

There are several new contenders on the debugging scene for PHP code, the most popular of which is FirePHP and their unholy union with FireBug. These two are great tools for debugging an Internet application but they both suffer from one fatal flaw in my eyes: the ability to view debugging information from anonymous Internet users.

Sure, it is a great feature to be able to hit a site and have debugging information pop up in a panel in my browser but how does that help me when dealing with users that I do not personally know? It doesn’t… Dumping data to a .log file offers several problems in and of itself, the largest of which is the rate at which said log file can reach an unwieldy size.

Another flaw in FirePHP is that sometimes you just want it short, sweet and not sent to the client. For years I have gone with a tried and true method of remote debugging which allows for me to view dumped data on a remote server. Yes, a REMOTE server… as in 3000 miles away and not in my browser.

Read the rest of this entry »

Technorati Tags: , , , , , ,