Php and js debugging

1,535 views

Published on

Published in: Technology, Design
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,535
On SlideShare
0
From Embeds
0
Number of Embeds
267
Actions
Shares
0
Downloads
11
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Php and js debugging

  1. 1. PHP and JS debugging by Andrei Perciun
  2. 2. What is debugging?Debugging is a methodical process offinding and reducing the number ofbugs, or defects, in a computerprogram or a piece of electronichardware, thus making it behave asexpected*** http://en.wikipedia.org/wiki/Debugging
  3. 3. PHP/Drupal debugging techniques
  4. 4. PHP debugging techniquesPHP/system configuration (php.ini) ○ display_errors = On ○ log_errors = On ○ error_log=”php-errors.log” ○ error_reporting = E_ALL & ~E_NOTICE ○ syslog/Event viewerPrint steps, variables, statements... ○ print/echo, print_r(), var_dump(), die()/exit() ○ debug_backtrace(), debug_print_backtrace() ○ Drupal - dpm(), drupal_set_message(), watchdog()Debuggers ○ XDebug * ○ Zend Debugger *** http://xdebug.org/** http://www.zend.com/en/products/server-ce/
  5. 5. Drupal debugging functionsCore functions ○ drupal_set_message() ○ watchdog() - watchdog(my_module, print_r($arr, TRUE));Devel ○ dpm() ○ dvm() ○ devel_render() - array element to the screen ○ db_queryd() - Drupal 6 only ○ dpq() - Drupal 7 only ○ views_debug()/vpr() ○ devel/php, devel/reinstall
  6. 6. XDebug● http://xdebug.org/● Configuration - http://xdebug.org/wizard.php● xdebug.remote_enable=On● xdebug.profiler_enable=On
  7. 7. Zend Debugger● http://static.zend.com/topics/Zend- Debugger-Installation-Guide.pdf● http://www.zend.com/en/products/server-ce/● Evaluate expressions
  8. 8. Javascript debugging techniques
  9. 9. JS debugging techniquesSystem configuration ○ IE - Disable script debugging, Display notification about every script error, Show Friendly HTTP errors ○ OtherPrint steps, variables, statements, network logs ○ alert() ○ console.log() ○ window.statusDebuggers ○ Firefox and Chrome - Firebug, plus default tools ○ IE - Developer tools ○ Opera - Dragonfly
  10. 10. What else?
  11. 11. Profiling● XDebug profiler● Zend Profiler● XHProf● PHP Profiler● New Relic (Pantheon & Acquia use it)
  12. 12. Thank you !andrei.perciun@wearepropeople.com

×