SlideShare a Scribd company logo
Using PHPDebugger - work in progress / unfinished - - work in progress / unfinished - December 2006 Stefan Pantke  [email_address] http://www.turingart.com /
Online resources Project info http://www.turingart.com/phpdebugger_lan__en.htm Mac OS X download http://www.turingart.com/downloads/phpDebugger.zip Windows download http://www.turingart.com/downloads/phpDebuggerWin.zip Sample report http://www.turingart.com/downloads/phpDebugger.pdf
In case you change something If you change ‚TADebugger.inc.php‘ Please forward your changed ‚TADebugger.inc.php‘ Probably add a sample PHP file, which uses your new feature If you‘d like to enrich the debugger protocol to post other types of information Please describe your change-request, I‘m happy to review
Motivation :: Debugging isn‘t that fun... Debugging applications is a time-consuming task  Without special debugging tools, this task gets even more time-consuming Client-side apps may redirect debug-output to a special log-window Web-apps can‘t access a log-window of a web-browser Writing log-entries on a web-server isn‘t that user friendly
Debuggers :: We have to so many... Yes, but some debuggers can‘t be used without a special IDE require a source-level re-compile of PHP are only available for Windows require a special browser
PHPDebugger :: Main features Two components: TADebugger at the PHP side and PHPDebugger at the client-side Interfaces with PHP using a new PHP class ‚TADebugger‘ PHP and PHPDebugger communicate using TCP  [-> Firewall ] Does not require a source-level re-compile of PHP Is available for Mac OS X and Windows, might be become available for Linux too Supports any browser and ships with a built-in one too [a simple one]
PHPDebugger :: Why use it? Improves quality of code TADebugger switches to the highest available error level and automatically catches as much errors as possible Keeps HTML clean while debugging TADebugger redirects all errors or exceptions to PHPDebugger and does not disrupt HTML by messages Makes messages persist PHPDebugger keeps messages, even if a new HTML page is loaded Prints debugging reports PHPDebugger allows to print well-formated reports for your team leader
For the rest, let‘s assume... 192.68.1.100 IP of the web-server your PHP web-app runs on  192.168.1.42 IP of the system PHPDebugger runs on 8881 Port, on which PHPDebugger listens [default port] /Applications/MAMP/htdocs/phpDebugger/ Web-server root of our PHP web-app Instrument one of your web-apps using the following step-by-step guide
PHPDebugger :: Installation Install ‚TADebugger.inc.php‘ somewhere in your web-app‘s folder You might wish to install the file your ‚includes‘ folder [assumed] Load the ‚TADebugger‘ class using  require_once( ‚includes/TADebugger.inc.php‘ ); as the first statement of your PHP source file Now, you may access the debugger using the  $sharedDebugger variable
PHPDebugger :: Setting up communication First, define where PHPDebugger runs and where your PHP web-app lives Define the IP of the system you launched PHPDebugger $sharedDebugger->myDebugHost = '192.168.1.42'; Define the port, which PHPDebugger listens on: $sharedDebugger->myDebugPort = 8881; Define the root folder of your web-app [optional] $sharedDebugger->setAppBasePath(  '/Applications/MAMP/htdocs/phpDebugger/' );
PHPDebugger :: Output for free... Now start PHPDebugger and click the ‚Stop/Pause‘ button in the upper left corner of the main window PHPDebugger is now prepared to receive messages from PHP Finally, call your web-app using some URL like this http://192.168.1.100/ Note, that you may already see certain messages, although you didn‘t added special debugging instructions These messages are for free, since TADebugger defined the highest possible error reporting level for you.
PHPDebugger :: Posting messages To post an arbitrary message from your web-app to PHPDebugger, add this to your code $sharedDebugger->postMessage( 'My Message' ); If you call this from within a function, ensure to declare it as global global  $sharedDebugger; postMessage() basically post one line messages of arbitrary data
PHPDebugger :: Posting backtraces To post a backtrace - a list of all currently called functions or methods - call this $sharedDebugger->postTrace(); PHPDebugger prints the first function/method called and each other one slightly shifted right Each argument passed will get printed too
PHPDebugger :: Inspecting variables TADebugger can trace variables using this call $sharedDebugger->traceVariable(  $myVar, 'some Info' ); All values of traced variable get posted back to PHPDebugger if you call this $sharedDebugger->postState(); Select ‚Window -> Data Inspector‘ in PHPDebugger to show inspected variables
PHPDebugger :: Installing sample code Copy the contents of the folder named ‚putContentsInWebRoot‘ in your web-server‘s ‚htdocs‘ folder Start PHPDebugger and click the ‚Pause/Start‘ button in the upper left corner once Launch the sample web-app using this URL http://192.168.1.100/phpDebugger/?k=23 You should see output as on the next slide...
Debug output of sample project of sample project Icons indicate message types  Color indicates source-code
Security Tips Protect your includes directory using a ‚.htaccess‘ file and add these lines # Reject any request regarding this directory Order deny,allow Deny from all Using this ‚.htaccess‘, your web-server denies any access to the ./includes/ directory Use the ‚.inc.php‘ extension for each include/require file and deny access using ‚.htaccess‘ settings in your web-app‘s root folder
General debugging tips Use  assert  to ensure contracts for functions and methods and check as much parameters as possible function handleRequest( $aRequstID ) { assert( is_integer( $aRequestID) ); // fails, if non string passed } // handleRequest Use type-safe comparisons  Good: if ( ‚something‘ === $aStringVariable) { ... } Less good: if ( ‚something‘  == $aStringVariable) { ... }
PHPDebugger :: Usage behind firewalls I need to install PHPDebugger behind a firewall. Will this work too? For now, the answer is ‚Probably no‘. Currently the ‚TADebugger‘ class initiates a connection. Thus your firewall is likely to not pass the request to PHPDebugger inside a NAT network If you are able to reconfigure your firewall, you need to open a firewall port and redirect it to the IP, where PHPDebugger is running on I‘d propose to acquire a free  http://www.dyndns.com / DNS record for your public IP and configure the ‚TADebugger‘ class to use this registered name An upcoming release will allow to initiate the communication from PHPDebugger by means of a server-side message-store
The Author Stefan Pantke Dipl.-Informatiker [M. Sc. CS] [email_address] I might wear polo shirts too ;-)
Thanks for your attention! http://www.turingart.com /

More Related Content

What's hot (20)

Test your code like a pro - PHPUnit in practice
Test your code like a pro - PHPUnit in practice
Sebastian Marek
 
Python Programming Essentials - M27 - Logging module
Python Programming Essentials - M27 - Logging module
P3 InfoTech Solutions Pvt. Ltd.
 
Symfony2 Components - The Event Dispatcher
Symfony2 Components - The Event Dispatcher
Sarah El-Atm
 
PHP traits, treat or threat?
PHP traits, treat or threat?
Nick Belhomme
 
Mastering Namespaces in PHP
Mastering Namespaces in PHP
Nick Belhomme
 
Working Effectively With Legacy Perl Code
Working Effectively With Legacy Perl Code
erikmsp
 
Can you upgrade to Puppet 4.x?
Can you upgrade to Puppet 4.x?
Martin Alfke
 
How To Test Everything
How To Test Everything
noelrap
 
EPHPC Webinar Slides: Unit Testing by Arthur Purnama
EPHPC Webinar Slides: Unit Testing by Arthur Purnama
Enterprise PHP Center
 
Getting testy with Perl
Getting testy with Perl
Workhorse Computing
 
Doing It Wrong with Puppet -
Doing It Wrong with Puppet -
Puppet
 
Unit Testing Lots of Perl
Unit Testing Lots of Perl
Workhorse Computing
 
Laravel 5.5 dev
Laravel 5.5 dev
RocketRoute
 
Diving into HHVM Extensions (PHPNW Conference 2015)
Diving into HHVM Extensions (PHPNW Conference 2015)
James Titcumb
 
Assurer - a pluggable server testing/monitoring framework
Assurer - a pluggable server testing/monitoring framework
Gosuke Miyashita
 
Puppet modules: An Holistic Approach
Puppet modules: An Holistic Approach
Alessandro Franceschi
 
Quality Assurance for PHP projects - ZendCon 2012
Quality Assurance for PHP projects - ZendCon 2012
Michelangelo van Dam
 
Python Programming Essentials - M35 - Iterators & Generators
Python Programming Essentials - M35 - Iterators & Generators
P3 InfoTech Solutions Pvt. Ltd.
 
React mit TypeScript – eine glückliche Ehe
React mit TypeScript – eine glückliche Ehe
inovex GmbH
 
Creating Lazy stream in CSharp
Creating Lazy stream in CSharp
Dhaval Dalal
 
Test your code like a pro - PHPUnit in practice
Test your code like a pro - PHPUnit in practice
Sebastian Marek
 
Symfony2 Components - The Event Dispatcher
Symfony2 Components - The Event Dispatcher
Sarah El-Atm
 
PHP traits, treat or threat?
PHP traits, treat or threat?
Nick Belhomme
 
Mastering Namespaces in PHP
Mastering Namespaces in PHP
Nick Belhomme
 
Working Effectively With Legacy Perl Code
Working Effectively With Legacy Perl Code
erikmsp
 
Can you upgrade to Puppet 4.x?
Can you upgrade to Puppet 4.x?
Martin Alfke
 
How To Test Everything
How To Test Everything
noelrap
 
EPHPC Webinar Slides: Unit Testing by Arthur Purnama
EPHPC Webinar Slides: Unit Testing by Arthur Purnama
Enterprise PHP Center
 
Doing It Wrong with Puppet -
Doing It Wrong with Puppet -
Puppet
 
Diving into HHVM Extensions (PHPNW Conference 2015)
Diving into HHVM Extensions (PHPNW Conference 2015)
James Titcumb
 
Assurer - a pluggable server testing/monitoring framework
Assurer - a pluggable server testing/monitoring framework
Gosuke Miyashita
 
Puppet modules: An Holistic Approach
Puppet modules: An Holistic Approach
Alessandro Franceschi
 
Quality Assurance for PHP projects - ZendCon 2012
Quality Assurance for PHP projects - ZendCon 2012
Michelangelo van Dam
 
Python Programming Essentials - M35 - Iterators & Generators
Python Programming Essentials - M35 - Iterators & Generators
P3 InfoTech Solutions Pvt. Ltd.
 
React mit TypeScript – eine glückliche Ehe
React mit TypeScript – eine glückliche Ehe
inovex GmbH
 
Creating Lazy stream in CSharp
Creating Lazy stream in CSharp
Dhaval Dalal
 

Viewers also liked (19)

Museoespectacular.Exc
Museoespectacular.Exc
trafegandoronseis
 
Beavers Vs Ducks
Beavers Vs Ducks
guesta8b7a1
 
O álbum ilustrado
O álbum ilustrado
trafegandoronseis
 
Diario De Eva
Diario De Eva
trafegandoronseis
 
Chanuka Story
Chanuka Story
marlal
 
Tema 1 Introdución ao estudo da Literatura 3º ESO
Tema 1 Introdución ao estudo da Literatura 3º ESO
trafegandoronseis
 
O exilio
O exilio
trafegandoronseis
 
Manuel Curros Enríquez, 3º ESO
Manuel Curros Enríquez, 3º ESO
trafegandoronseis
 
Ad

Similar to Php Debugger (20)

Xdebug
Xdebug
Bryce Embry
 
Write your first WordPress plugin
Write your first WordPress plugin
Anthony Montalbano
 
Bugzilla Installation Process
Bugzilla Installation Process
Vino Harikrishnan
 
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
DECK36
 
Introduction to Google App Engine with Python
Introduction to Google App Engine with Python
Brian Lyttle
 
Drupal Development w/ PhpStorm and Xdebug
Drupal Development w/ PhpStorm and Xdebug
Chris Haynes
 
WordPress Plugin Development For Beginners
WordPress Plugin Development For Beginners
johnpbloch
 
Apache Web Server Setup 3
Apache Web Server Setup 3
Information Technology
 
are available here
are available here
webhostingguy
 
Profiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / Webgrind
Sam Keen
 
Xdebug from a to x
Xdebug from a to x
Gennady Feldman
 
Getting started with WordPress development
Getting started with WordPress development
Steve Mortiboy
 
Its3 Drupal
Its3 Drupal
guest954945a
 
Its3 Drupal
Its3 Drupal
guest954945a
 
Use Xdebug to profile PHP
Use Xdebug to profile PHP
Seravo
 
WordPress Plugin Development 201
WordPress Plugin Development 201
ylefebvre
 
PHP: Debugger, Profiler and more
PHP: Debugger, Profiler and more
Võ Duy Tuấn
 
Diagnosing WordPress: What to do when things go wrong
Diagnosing WordPress: What to do when things go wrong
WordCamp Sydney
 
WPDay Bologna 2013
WPDay Bologna 2013
Danilo Ercoli
 
WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019
Anam Ahmed
 
Write your first WordPress plugin
Write your first WordPress plugin
Anthony Montalbano
 
Bugzilla Installation Process
Bugzilla Installation Process
Vino Harikrishnan
 
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
DECK36
 
Introduction to Google App Engine with Python
Introduction to Google App Engine with Python
Brian Lyttle
 
Drupal Development w/ PhpStorm and Xdebug
Drupal Development w/ PhpStorm and Xdebug
Chris Haynes
 
WordPress Plugin Development For Beginners
WordPress Plugin Development For Beginners
johnpbloch
 
Profiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / Webgrind
Sam Keen
 
Getting started with WordPress development
Getting started with WordPress development
Steve Mortiboy
 
Use Xdebug to profile PHP
Use Xdebug to profile PHP
Seravo
 
WordPress Plugin Development 201
WordPress Plugin Development 201
ylefebvre
 
PHP: Debugger, Profiler and more
PHP: Debugger, Profiler and more
Võ Duy Tuấn
 
Diagnosing WordPress: What to do when things go wrong
Diagnosing WordPress: What to do when things go wrong
WordCamp Sydney
 
WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019
Anam Ahmed
 
Ad

Recently uploaded (20)

Introduction to Typescript - GDG On Campus EUE
Introduction to Typescript - GDG On Campus EUE
Google Developer Group On Campus European Universities in Egypt
 
Artificial Intelligence in the Nonprofit Boardroom.pdf
Artificial Intelligence in the Nonprofit Boardroom.pdf
OnBoard
 
Data Validation and System Interoperability
Data Validation and System Interoperability
Safe Software
 
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
 
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
Oracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI Professional
VICTOR MAESTRE RAMIREZ
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
MuleSoft for AgentForce : Topic Center and API Catalog
MuleSoft for AgentForce : Topic Center and API Catalog
shyamraj55
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Anish Kumar
 
High Availability On-Premises FME Flow.pdf
High Availability On-Premises FME Flow.pdf
Safe Software
 
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
SOFTTECHHUB
 
Enabling BIM / GIS integrations with Other Systems with FME
Enabling BIM / GIS integrations with Other Systems with FME
Safe Software
 
The State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry Report
Liveplex
 
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
Safe Software
 
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
Safe Software
 
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Safe Software
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 
Artificial Intelligence in the Nonprofit Boardroom.pdf
Artificial Intelligence in the Nonprofit Boardroom.pdf
OnBoard
 
Data Validation and System Interoperability
Data Validation and System Interoperability
Safe Software
 
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
 
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
Oracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI Professional
VICTOR MAESTRE RAMIREZ
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
MuleSoft for AgentForce : Topic Center and API Catalog
MuleSoft for AgentForce : Topic Center and API Catalog
shyamraj55
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Anish Kumar
 
High Availability On-Premises FME Flow.pdf
High Availability On-Premises FME Flow.pdf
Safe Software
 
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
SOFTTECHHUB
 
Enabling BIM / GIS integrations with Other Systems with FME
Enabling BIM / GIS integrations with Other Systems with FME
Safe Software
 
The State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry Report
Liveplex
 
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
FME for Distribution & Transmission Integrity Management Program (DIMP & TIMP)
Safe Software
 
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
Safe Software
 
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Safe Software
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 

Php Debugger

  • 1. Using PHPDebugger - work in progress / unfinished - - work in progress / unfinished - December 2006 Stefan Pantke [email_address] http://www.turingart.com /
  • 2. Online resources Project info http://www.turingart.com/phpdebugger_lan__en.htm Mac OS X download http://www.turingart.com/downloads/phpDebugger.zip Windows download http://www.turingart.com/downloads/phpDebuggerWin.zip Sample report http://www.turingart.com/downloads/phpDebugger.pdf
  • 3. In case you change something If you change ‚TADebugger.inc.php‘ Please forward your changed ‚TADebugger.inc.php‘ Probably add a sample PHP file, which uses your new feature If you‘d like to enrich the debugger protocol to post other types of information Please describe your change-request, I‘m happy to review
  • 4. Motivation :: Debugging isn‘t that fun... Debugging applications is a time-consuming task Without special debugging tools, this task gets even more time-consuming Client-side apps may redirect debug-output to a special log-window Web-apps can‘t access a log-window of a web-browser Writing log-entries on a web-server isn‘t that user friendly
  • 5. Debuggers :: We have to so many... Yes, but some debuggers can‘t be used without a special IDE require a source-level re-compile of PHP are only available for Windows require a special browser
  • 6. PHPDebugger :: Main features Two components: TADebugger at the PHP side and PHPDebugger at the client-side Interfaces with PHP using a new PHP class ‚TADebugger‘ PHP and PHPDebugger communicate using TCP [-> Firewall ] Does not require a source-level re-compile of PHP Is available for Mac OS X and Windows, might be become available for Linux too Supports any browser and ships with a built-in one too [a simple one]
  • 7. PHPDebugger :: Why use it? Improves quality of code TADebugger switches to the highest available error level and automatically catches as much errors as possible Keeps HTML clean while debugging TADebugger redirects all errors or exceptions to PHPDebugger and does not disrupt HTML by messages Makes messages persist PHPDebugger keeps messages, even if a new HTML page is loaded Prints debugging reports PHPDebugger allows to print well-formated reports for your team leader
  • 8. For the rest, let‘s assume... 192.68.1.100 IP of the web-server your PHP web-app runs on 192.168.1.42 IP of the system PHPDebugger runs on 8881 Port, on which PHPDebugger listens [default port] /Applications/MAMP/htdocs/phpDebugger/ Web-server root of our PHP web-app Instrument one of your web-apps using the following step-by-step guide
  • 9. PHPDebugger :: Installation Install ‚TADebugger.inc.php‘ somewhere in your web-app‘s folder You might wish to install the file your ‚includes‘ folder [assumed] Load the ‚TADebugger‘ class using require_once( ‚includes/TADebugger.inc.php‘ ); as the first statement of your PHP source file Now, you may access the debugger using the $sharedDebugger variable
  • 10. PHPDebugger :: Setting up communication First, define where PHPDebugger runs and where your PHP web-app lives Define the IP of the system you launched PHPDebugger $sharedDebugger->myDebugHost = '192.168.1.42'; Define the port, which PHPDebugger listens on: $sharedDebugger->myDebugPort = 8881; Define the root folder of your web-app [optional] $sharedDebugger->setAppBasePath( '/Applications/MAMP/htdocs/phpDebugger/' );
  • 11. PHPDebugger :: Output for free... Now start PHPDebugger and click the ‚Stop/Pause‘ button in the upper left corner of the main window PHPDebugger is now prepared to receive messages from PHP Finally, call your web-app using some URL like this http://192.168.1.100/ Note, that you may already see certain messages, although you didn‘t added special debugging instructions These messages are for free, since TADebugger defined the highest possible error reporting level for you.
  • 12. PHPDebugger :: Posting messages To post an arbitrary message from your web-app to PHPDebugger, add this to your code $sharedDebugger->postMessage( 'My Message' ); If you call this from within a function, ensure to declare it as global global $sharedDebugger; postMessage() basically post one line messages of arbitrary data
  • 13. PHPDebugger :: Posting backtraces To post a backtrace - a list of all currently called functions or methods - call this $sharedDebugger->postTrace(); PHPDebugger prints the first function/method called and each other one slightly shifted right Each argument passed will get printed too
  • 14. PHPDebugger :: Inspecting variables TADebugger can trace variables using this call $sharedDebugger->traceVariable( $myVar, 'some Info' ); All values of traced variable get posted back to PHPDebugger if you call this $sharedDebugger->postState(); Select ‚Window -> Data Inspector‘ in PHPDebugger to show inspected variables
  • 15. PHPDebugger :: Installing sample code Copy the contents of the folder named ‚putContentsInWebRoot‘ in your web-server‘s ‚htdocs‘ folder Start PHPDebugger and click the ‚Pause/Start‘ button in the upper left corner once Launch the sample web-app using this URL http://192.168.1.100/phpDebugger/?k=23 You should see output as on the next slide...
  • 16. Debug output of sample project of sample project Icons indicate message types Color indicates source-code
  • 17. Security Tips Protect your includes directory using a ‚.htaccess‘ file and add these lines # Reject any request regarding this directory Order deny,allow Deny from all Using this ‚.htaccess‘, your web-server denies any access to the ./includes/ directory Use the ‚.inc.php‘ extension for each include/require file and deny access using ‚.htaccess‘ settings in your web-app‘s root folder
  • 18. General debugging tips Use assert to ensure contracts for functions and methods and check as much parameters as possible function handleRequest( $aRequstID ) { assert( is_integer( $aRequestID) ); // fails, if non string passed } // handleRequest Use type-safe comparisons Good: if ( ‚something‘ === $aStringVariable) { ... } Less good: if ( ‚something‘ == $aStringVariable) { ... }
  • 19. PHPDebugger :: Usage behind firewalls I need to install PHPDebugger behind a firewall. Will this work too? For now, the answer is ‚Probably no‘. Currently the ‚TADebugger‘ class initiates a connection. Thus your firewall is likely to not pass the request to PHPDebugger inside a NAT network If you are able to reconfigure your firewall, you need to open a firewall port and redirect it to the IP, where PHPDebugger is running on I‘d propose to acquire a free http://www.dyndns.com / DNS record for your public IP and configure the ‚TADebugger‘ class to use this registered name An upcoming release will allow to initiate the communication from PHPDebugger by means of a server-side message-store
  • 20. The Author Stefan Pantke Dipl.-Informatiker [M. Sc. CS] [email_address] I might wear polo shirts too ;-)
  • 21. Thanks for your attention! http://www.turingart.com /