PHP: Debugger, Profiler and more

  • 6,265 views
Uploaded 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.

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.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
6,265
On Slideshare
0
From Embeds
0
Number of Embeds
4

Actions

Shares
Downloads
89
Comments
0
Likes
2

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

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