0
PHP Debugger, Profiler & more Vo Duy Tuan – <tuanmaster2002@yahoo.com> Bloghoctap.com Coding is not enough!
$Table_of_contents <ul><li>IDEs for Web Developer </li></ul><ul><li>Debugging </li></ul><ul><li>Profiling </li></ul><ul><l...
<ul><li>Learn about IDE. </li></ul>IDEs for Web Developer 1
1.1. What is an IDE? <ul><li>Integrated Development Environment </li></ul><ul><li>Application for software development </l...
1.2. Common IDEs for Web Developer <ul><li>Notepad, Notepad++ </li></ul><ul><li>Adobe Dreamweaver </li></ul><ul><li>Aptana...
1.3. Recommend Features for PHP IDE <ul><li>Built-in parser </li></ul><ul><li>Documentor </li></ul><ul><li>Debugger </li><...
1.4. Small Quizz <ul><ul><li>What is the difference between 2 screenshots? </li></ul></ul>
<ul><li>IDE for PHP, support HTML, CSS </li></ul><ul><li>Paid Software, current version: 5.9 </li></ul><ul><li>Main Featur...
1.6. NuSphere PhpEd screenshot
<ul><li>Learn how to use PhpEd Debugger to debug your web applications. </li></ul>Debugging 2
<ul><li>What is debug?  </li></ul><ul><ul><li>Find errors in your code. </li></ul></ul><ul><li>How to debug? </li></ul><ul...
<ul><li>Integrate with Firefox (DBGbar addon) </li></ul><ul><li>Step debugging </li></ul><ul><li>Multi breakpoint </li></u...
2.3. PhpEd Debugger Installation <ul><li>Step 1: Install php extension </li></ul><ul><li>Step 2: Install DBGbar addon for ...
Step 1: Install PHP Extension <ul><li>Go to ‘C:..nuspherephpeddebuggerserver’  </li></ul><ul><li>Select correct library fo...
Step 2: Install DBGbar addon <ul><li>In Firefox, go to menu Tools >> Add-ons </li></ul><ul><li>Search ‘DBGbar’ and install...
Step 3: Update PHP.INI config <ul><li>Add dbg extension to extension list: </li></ul><ul><ul><li>extension=dbg-php-5.2.dll...
2.4. PhpEd Debugger usage
2.5. DEMO Debugging
<ul><li>Learn how to use Xdebug extension to find bottleneck and increase performance for your web applications. </li></ul...
3.1. Profiling Introduction <ul><li>Find bottleneck </li></ul><ul><li>Make application run faste </li></ul>
3.2. Two ways of profiling <ul><li>Built-in profiler </li></ul><ul><li>3 rd -party profiler </li></ul>
3.2.1. Built-in profiler <ul><li>Tracking code embed in your PHP code </li></ul><ul><li>Example: Using timer start & stop ...
3.2.1. Built-in profiler…cont.
3.2.2. 3 rd -party profiler <ul><li>Install new extension </li></ul><ul><li>Do not change your PHP code </li></ul><ul><li>...
3.3. Xdebug Installation <ul><li>Step 1: Install php extension </li></ul><ul><li>Step 2: Update PHP.INI config </li></ul><...
Step 1: Install php extension <ul><li>Download correct extension for your platform & PHP version </li></ul><ul><li>Can go ...
Step 2: Update PHP.INI config <ul><li>Add configuration for xdebug: </li></ul><ul><ul><li>[xdebug] </li></ul></ul><ul><ul>...
3.4. Xdebug Usage <ul><li>Step 1: Generate cachegrind file </li></ul><ul><ul><li>Base on xdebug config in PHP.INI to creat...
2.4. Xdebug Usage… <ul><li>Step 2: View & analyze your profile result: </li></ul><ul><ul><li>WinCacheGrind </li></ul></ul>...
2.4.1. WinCacheGrind Viewer
2.4.2. Kcachegrind Viewer
3.5. DEMO Profiling
<ul><li>Benchmark your web application. </li></ul>Load Testing 4
4.1. ApacheBench
4.2. Apache jMeter
<ul><li>… Võ Duy Tuấn </li></ul><ul><li>… [email_address] </li></ul><ul><li>… Web Freelancer </li></ul><ul><li>…  PHP Trai...
<ul><li>It’s time to  query  … </li></ul>Thanks you!
Upcoming SlideShare
Loading in...5
×

PHP: Debugger, Profiler and more

6,466

Published on

Slide introduce about the process of debugging and profling a web application. How to use PHPED debugger to debug your application and Xdebug to profile your application.

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
6,466
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
95
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Transcript of "PHP: Debugger, Profiler and more"

  1. 1. PHP Debugger, Profiler & more Vo Duy Tuan – <tuanmaster2002@yahoo.com> Bloghoctap.com Coding is not enough!
  2. 2. $Table_of_contents <ul><li>IDEs for Web Developer </li></ul><ul><li>Debugging </li></ul><ul><li>Profiling </li></ul><ul><li>Load Testing </li></ul>Tài trợ:
  3. 3. <ul><li>Learn about IDE. </li></ul>IDEs for Web Developer 1
  4. 4. 1.1. What is an IDE? <ul><li>Integrated Development Environment </li></ul><ul><li>Application for software development </li></ul><ul><li>Common Features: </li></ul><ul><ul><li>Syntax highlight </li></ul></ul><ul><ul><li>Autocomplete </li></ul></ul><ul><ul><li>File Explorer </li></ul></ul><ul><ul><li>Collapse/Expand </li></ul></ul>
  5. 5. 1.2. Common IDEs for Web Developer <ul><li>Notepad, Notepad++ </li></ul><ul><li>Adobe Dreamweaver </li></ul><ul><li>Aptana </li></ul><ul><li>Komodo </li></ul><ul><li>PhpEd </li></ul><ul><li>Zend Studio </li></ul><ul><li>PHP Designer </li></ul><ul><li>… </li></ul>
  6. 6. 1.3. Recommend Features for PHP IDE <ul><li>Built-in parser </li></ul><ul><li>Documentor </li></ul><ul><li>Debugger </li></ul><ul><li>DB Client </li></ul><ul><li>Text Format </li></ul>
  7. 7. 1.4. Small Quizz <ul><ul><li>What is the difference between 2 screenshots? </li></ul></ul>
  8. 8. <ul><li>IDE for PHP, support HTML, CSS </li></ul><ul><li>Paid Software, current version: 5.9 </li></ul><ul><li>Main Features: </li></ul><ul><ul><li>Debugger </li></ul></ul><ul><ul><li>Autocomplete </li></ul></ul><ul><ul><li>DB Client </li></ul></ul><ul><ul><li>Documentor </li></ul></ul><ul><ul><li>Code Explorer </li></ul></ul><ul><ul><li>Exclude folders, files in project. </li></ul></ul>1.5. NuSphere PhpEd Introduction
  9. 9. 1.6. NuSphere PhpEd screenshot
  10. 10. <ul><li>Learn how to use PhpEd Debugger to debug your web applications. </li></ul>Debugging 2
  11. 11. <ul><li>What is debug? </li></ul><ul><ul><li>Find errors in your code. </li></ul></ul><ul><li>How to debug? </li></ul><ul><ul><li>Output with HTML: echo() , print_r() , var_dump() </li></ul></ul><ul><ul><li>Store debug information: File, Database </li></ul></ul><ul><ul><li>Live debug: PhpEd Debugger </li></ul></ul>2.1. Debug Introduction
  12. 12. <ul><li>Integrate with Firefox (DBGbar addon) </li></ul><ul><li>Step debugging </li></ul><ul><li>Multi breakpoint </li></ul><ul><li>Watch runtime variables </li></ul><ul><li>Watch call stack </li></ul><ul><li>Remote debugging </li></ul>2.2. PhpEd Debugger features
  13. 13. 2.3. PhpEd Debugger Installation <ul><li>Step 1: Install php extension </li></ul><ul><li>Step 2: Install DBGbar addon for Firefox </li></ul><ul><li>Step 3: Update PHP.INI config </li></ul><ul><li>Restart your web server (if needed) </li></ul>
  14. 14. Step 1: Install PHP Extension <ul><li>Go to ‘C:..nuspherephpeddebuggerserver’ </li></ul><ul><li>Select correct library for your platform and PHP version </li></ul><ul><li>Copy file (.dll on Windows) to php extension folder </li></ul>
  15. 15. Step 2: Install DBGbar addon <ul><li>In Firefox, go to menu Tools >> Add-ons </li></ul><ul><li>Search ‘DBGbar’ and install. </li></ul><ul><li>Restart Firefox, you will get DBGbar toolbar: </li></ul>
  16. 16. Step 3: Update PHP.INI config <ul><li>Add dbg extension to extension list: </li></ul><ul><ul><li>extension=dbg-php-5.2.dll </li></ul></ul><ul><li>Add configuration for debugger </li></ul><ul><ul><li>[debugger] debugger.enabled=on debugger.profiler_enabled=on debugger.hosts_allow=localhost apple.com debugger.hosts_deny=ALL debugger.ports=7869, 10000/16 </li></ul></ul>
  17. 17. 2.4. PhpEd Debugger usage
  18. 18. 2.5. DEMO Debugging
  19. 19. <ul><li>Learn how to use Xdebug extension to find bottleneck and increase performance for your web applications. </li></ul>Profiling 3
  20. 20. 3.1. Profiling Introduction <ul><li>Find bottleneck </li></ul><ul><li>Make application run faste </li></ul>
  21. 21. 3.2. Two ways of profiling <ul><li>Built-in profiler </li></ul><ul><li>3 rd -party profiler </li></ul>
  22. 22. 3.2.1. Built-in profiler <ul><li>Tracking code embed in your PHP code </li></ul><ul><li>Example: Using timer start & stop </li></ul>
  23. 23. 3.2.1. Built-in profiler…cont.
  24. 24. 3.2.2. 3 rd -party profiler <ul><li>Install new extension </li></ul><ul><li>Do not change your PHP code </li></ul><ul><li>More Information </li></ul><ul><li>Famous Library: Xdebug </li></ul>
  25. 25. 3.3. Xdebug Installation <ul><li>Step 1: Install php extension </li></ul><ul><li>Step 2: Update PHP.INI config </li></ul><ul><li>Restart your server (if needed) </li></ul>
  26. 26. Step 1: Install php extension <ul><li>Download correct extension for your platform & PHP version </li></ul><ul><li>Can go to ‘ http://www.xdebug.org/find-binary.php ’ to find correct Xdebug file for your system from phpinfo() output </li></ul><ul><li>Copy file (.dll on Windows) to php extension folder </li></ul>
  27. 27. Step 2: Update PHP.INI config <ul><li>Add configuration for xdebug: </li></ul><ul><ul><li>[xdebug] </li></ul></ul><ul><ul><li>zend_extension_ts = C:AppServphp5extphp_xdebug-2.1.0-5.2-vc6.dll </li></ul></ul><ul><ul><li>xdebug.profiler_output_dir = &quot;C:xdebug&quot; </li></ul></ul><ul><ul><li>xdebug.profiler_output_name = &quot;callgrind.%R.%t&quot; </li></ul></ul><ul><ul><li>xdebug.profiler_enable = 0 </li></ul></ul><ul><ul><li>xdebug.profiler_append=0 </li></ul></ul><ul><ul><li>xdebug.profiler_enable_trigger = 1 </li></ul></ul><ul><ul><li>xdebug.extended_info=1 </li></ul></ul>
  28. 28. 3.4. Xdebug Usage <ul><li>Step 1: Generate cachegrind file </li></ul><ul><ul><li>Base on xdebug config in PHP.INI to create cachegrind file. </li></ul></ul><ul><ul><li>For above php.ini config: Add parameter XDEBUG_PROFILE to your request string will create cachegrind file. Examp;e: </li></ul></ul><ul><ul><ul><li>Normal : http://bloghoctap.com </li></ul></ul></ul><ul><ul><ul><li>Profiler: http://bloghoctap.com?XDEBUG_PROFILE </li></ul></ul></ul>
  29. 29. 2.4. Xdebug Usage… <ul><li>Step 2: View & analyze your profile result: </li></ul><ul><ul><li>WinCacheGrind </li></ul></ul><ul><ul><li>Kcachegrind </li></ul></ul>
  30. 30. 2.4.1. WinCacheGrind Viewer
  31. 31. 2.4.2. Kcachegrind Viewer
  32. 32. 3.5. DEMO Profiling
  33. 33. <ul><li>Benchmark your web application. </li></ul>Load Testing 4
  34. 34. 4.1. ApacheBench
  35. 35. 4.2. Apache jMeter
  36. 36. <ul><li>… Võ Duy Tuấn </li></ul><ul><li>… [email_address] </li></ul><ul><li>… Web Freelancer </li></ul><ul><li>… PHP Trainer </li></ul><ul><li>… http://blogHoctap.com </li></ul>you_forgot If
  37. 37. <ul><li>It’s time to query … </li></ul>Thanks you!
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×