Xdebug from A to X By Gennady Feldman Aug 25, 2009.

Slides:



Advertisements
Similar presentations
Classic Data Access Training Compliance Test Tool (OpcAnalyzer)
Advertisements

Pubman and Selenium tests. What is Selenium Selenium is a suite of Web application test automation tools for any browser on any operating system –Firefox,
® IBM Software Group © 2010 IBM Corporation What’s New in Profiling & Code Coverage RAD V8 April 21, 2011 Kathy Chan
{ Debugging PHP with Xdebug Stephanie Russell Zachary Klink.
KX-NS1000 Initial Set Up For step by step : 16 May,
Creating a Program In today’s lesson we will look at: what programming is different types of programs how we create a program installing an IDE to get.
Senior Design Lab Policies Presented by: Trey Murdoch CSC IT Staff.
Module 6 Windows 2000 Professional 6.1 Installation 6.2 Administration/User Interface 6.3 User Accounts 6.4 Managing the File System 6.5 Services.
IERG4180 Tutorial 4 Jim.
Sayed Ahmed BSc. Eng. in Computer Engineering, BUET, Bangladesh MSc., Computer Science, U of Manitoba, Canada Software/Computer Engineer, Canada
SEEM4570: XAMPP, Eclipse, Summary of Html Kangfei Zhao Room 711,ERB
Automation using Selenium Authored & Presented by : Chinmay Sathe & Amit Prabhu Cybage Software Pvt. Ltd.
8/17/2015CS346 PHP1 Module 1 Introduction to PHP.
Linux Operations and Administration
Getting Started With Java Downloading and installing software Running your first program Dr. DwyerFall 2012.
Citation Management: Using Zotero Brought to you by: Research Commons [Dana C., Mehdi P., Sarah E.] September 26, 2012.
1. Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall 2 Technology in Action Technology in Focus: Computing Alternatives.
PHP HYPERTEXT: PREPROCESSOR By: Justin T. Pleva. WHAT IS PHP?  General purpose  Server-side web development  Console application.
Computer Concepts 2014 Chapter 7 The Web and .
Linux Operations and Administration
PHP Tutorials 02 Olarik Surinta Management Information System Faculty of Informatics.
WaveMaker Visual AJAX Studio 4.0 Training Troubleshooting.
The Art of Debugging Shlomy Gantz 02/13/01MDCFUG.
The NetBeans IDE CSIS 3701: Advanced Object Oriented Programming.
Eclipse Overview Introduction to Web Programming Kirkwood Continuing Education Fred McClurg © Copyright 2015, Fred McClurg, All Rights Reserved.
1 Test Automation For Web-Based Applications Selenium HP Web Test Tool Training Portnov Computer School.
_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the.
10/5/2015CS346 PHP1 Module 1 Introduction to PHP.
Chapter 1: The Internet and the WWW CIS 275—Web Application Development for Business I.
1 3. Computing System Fundamentals 3.1 Language Translators.
Netbeans Intro & Who's used Netbeans And then un-installed it?
Website Development with PHP and MySQL Saving Data.
Prachi Chitnis.  The CSS feel  SDS – Synoptic Display Studio  ADL Converter  PV table, Probe…
CS 4720 Dynamic Web Applications CS 4720 – Web & Mobile Systems.
Pubman and Selenium tests. What is Selenium Selenium is a suite of Web application test automation tools for any browser on any operating system –Firefox,
1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development.
DEV303 ASP.NET: Leveraging Visual Studio.NET For Web Projects Tony Goodhew Product Manager Microsoft Corp.
Website Administration Information Systems 337 Prof. Harry Plantinga.
© 2015 by McGraw-Hill Education. This proprietary material solely for authorized instructor use. Not authorized for sale or distribution in any manner.
Install and Configure PHP: XAMPP, LAMP, IDEs PHP, CGI, Web Server. XAMP / LAMP / PHP in IIS. PHP IDEs SoftUni Team Technical Trainers Software University.
Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.
GOSS iCM Gary Ratcliffe. 2 Agenda Webinar Programme V10 Overview Version Information Supported Browsers Architectural Changes New Features.
Debugging 1/6/2016. Debugging 1/6/2016 Debugging  Debugging is a methodical process of finding and reducing the number of bugs, or defects, in a program.
© 2002 IBM Corporation Transaction Processing Facility TPF Users Group Acapulco May 2004 © 2004 IBM Corporation Pete Nicholls IBM Toronto Lab TPF Toolkit.
TOPIC 7.0 LINUX SERVICES AND CONFIGURATION. ROOT USER Root user is called “super user” because it has power far beyond those of mortal user. As root,
SPI NIGHTLIES Alex Hodgkins. SPI nightlies  Build and test various software projects each night  Provide a nightlies summary page that displays all.
PHP code profiling using XDebug By Gennady Feldman June 16, 2009.
Web Page Designing With Dreamweaver MX\Session 1\1 of 9 Session 1 Introduction to PHP Hypertext Preprocessor - PHP.
Netbeans QuickStart. Creating a project File->New Project –For now you want General->Java Application –Then fill in the project details.
Sung-Dong Kim Dept. of Computer Engineering, Hansung University Chapter 3 Programming Tools.
SQL Server Reporting Services for.NET Developers Bret Stateham
Top 5 IDE that Simplifies PHP Development Biztech IT Consultancy Pvt. Ltd. | |
Custom Authentication Providers For DotNetNuke v5.0 Stan Schultes – Sarasota, FL Florida Community Leader
What's New in Visual Studio 2010 Debugging Brian Peek Senior Consultant, ASPSOFT, Inc. Microsoft MVP - C#
Cool CF Debugging Shlomy Gantz 07/29/01CF_ODYSSEY.
CF Eclipse Nick Kwiatkowski Michigan State University, Physical Plant 8/8/2006.
CSCI 3100 Tutorial 5 JavaScript & Ajax Jichuan Zeng Department of Computer Science and Engineering The Chinese University of Hong.
IBM Worklight environment setup 1. Eclipse IDE Multi-purpose integrated development environment (IDE) Open source Supported for Windows, Mac OS X, Linux.
Web Application Development with PHP in Netbeans 6.5 ● Angad Singh Campus Ambassador Tech Lead
9/21/04 James Gallagher Server Installation and Testing: Hands-on ● Install the CGI server with the HDF and FreeForm handlers ● Link data so the server.
PHP Development Environment Setting Marketplace(e) OS Min-Chul Jeong 최진완
Debugging RTC CLI in Eclipse
Tutorial Six Linux Basics CompSci Semester Two 2016.
Setup a PHP + MySQL Development Environment
Web Systems Development (CSC-215)
Install Ruby If you are running on Mac OS X, Ruby is preinstalled.
Configuration Of A Pull Network.
Class Projects and Environment
Lecture 5: Functions and Parameters
Video Notes.
Presentation transcript:

Xdebug from A to X By Gennady Feldman Aug 25, 2009

Agenda ► Installation ► Error Handling ► Debugging ► Profiling ► Function Traces

Xdebug Features ► Variable display ► Stack Traces ► Profiling PHP Scripts ► Remote Debugging ► Function Traces ► Code Coverage Analysis* * Not covered in this presentation.

Installing ► Xdebug is a PHP extension. (written in C) ► Xdebug is Open Source so you could download and build/install it yourself. ► Almost every Linux distro today provides an Xdebug binary package. ► Binaries are also available for Windows from website.

Installing (Part 2) ► On Ubuntu 9.04:  apt-get install php5-xdebug ► On Mandriva:  urpmi php5-xdebug ► Using PEAR/PECL:  pecl install xdebug  pecl upgrade xdebug

Installing (Part 3) ► To enable xdebug add the fullpath to xdebug.so: zend_extension=/usr/lib/php5/ lfs/xdebug.so  To php.ini or  To conf.d/xdebug.ini file ► You could also setup system wide defaults as well through the ini file.

Installing (Part 4) ► Check that Xdebug is installed via:  php –v  php –m  php –ri xdebug ► Check phpinfo() report and look for xdebug section. ► You might need to restart your web server.

Error Handling (display_errors off)

Error Handling (display_errors on)

Error Handling (display_errors On w/ xdebug)

Error Handling (display_errors on w/ Xdebug)

Error Handling (My.htaccess) php_flag xdebug.collect_vars on php_value xdebug.collect_params 4 php_flag xdebug.dump_globals on php_value xdebug.dump.SERVER REQUEST_URI php_value xdebug.dump.GET * php_value xdebug.dump.POST * php_value xdebug.dump.COOKIE * php_flag xdebug.show_local_vars on ► Documentation: ► Also check phpinfo(), specifically Xdebug section

Remote Debugging ► XDebug has Remove Debugging support through GDB (old) and DBGP (new) protocols. ► You will need a client that can speak one of these protocols. ► You will need to adjust Xdebug settings on the server to enable remote debugging. ► You can also debug CLI scripts.

Remote Debugging (Clients) ► Dev-PHP (IDE: Windows) Dev-PHP ► Eclipse plugin, which has been submitted as an enhancement for the PDT (IDE). pluginPDTpluginPDT ► Emacs plugin (Editor Plugin). plugin ► ActiveState's Komodo (IDE: Windows, Linux, Mac; Commercial). Komodo ► MacGDBP - Standalone Mac client. MacGDBP ► NetBeans (IDE: Windows, Linux, Mac OS X and Solaris. NetBeans ► Notepad++ plugin (IDE: Windows). Notepad++plugin Notepad++plugin ► WaterProof's PHPEdit (IDE, from version 2.10: Windows; Commercial). PHPEdit ► Anchor System's Peggy (IDE: Windows, Japanese; Commercial). Peggy ► MP Software's phpDesigner (IDE: Windows, Commercial). phpDesigner ► PHPEclipse (Editor Plugin). PHPEclipse ► Protoeditor (Editor: Linux). Protoeditor ► tsWebeditor (Editor: Windows). tsWebeditor ► Xored's TrueStudio IDE (IDE; Commercial). TrueStudio IDETrueStudio IDE ► VIM plugin (Tutorial) (Editor Plugin). pluginTutorialpluginTutorial ► jcx software's VS.Php (MS Visual Studio Plugin; Commercial). VS.Php ► XDebugClient - Standalone Windows client. XDebugClient * Source:

Remote Debugging (Server) ► Need to enable remote debugging on the server:  php_value xdebug.remote_enable 1  php_value xdebug.remote_host  php_value xdebug.remote_port 9000  php_value xdebug.remote_mode req ► remote_host - takes a hostname or IP address (There’s a patch from Facebook devs to remove this restriction) ► remote_mode – controls when the remote debugging starts:  req - at the beginning of the script  jit - upon an error condition

Remote Debugging (Starting) ► xdebug_break( ) ► XDEBUG_SESSION_START variable passed via GET or POST sets XDEBUG_SESSION cookie. ► XDebug Helper Firefox Addon: US/firefox/addon/ US/firefox/addon/ US/firefox/addon/3960

Profiling ► Xdebug's built-in profiler generates cachegrind files. ► You will need a tool that can read and visualize cachegrind files. ► You will need to adjust some XDebug settings in order to enable profiling on the server.

Profiling (Starting) ► Need to enable profiling on the server: php_value xdebug.profiler_enabled 1 php_value xdebug.profiler_append 1 php_value xdebug.profiler_enable_trigger 1 php_value xdebug.profiler_output_dir /tmp php_value xdebug.profiler_output_name cachegrind.out.%p ► You need to set xdebug.profiler_enable_trigger if you want to trigger the profiling yourself. ► You can trigger profiling via XDEBUG_PROFILE variable passed via GET or POST (or via XDebug Helper Firefox Addon) sets XDEBUG_PROFILE cookie.

WebGrind

WinCacheGrind

MacCallGrind

KCacheGrind

Function Traces ► Xdebug allows you to log all function calls, including parameters and return values to a file in different formats. ► Function trace files contain a timeline and record of each function call in PHP including file and line number. ► It’s a great way to see exactly what’s going on. (At times a bit too much detail)

Function Traces

Function Traces (VIM Syntax) ► Xdebug package comes with a VIM syntax highlight file. ► Copy the xt.vim file to ~/.vim/syntax ► Edit, or create, ~/.vim/filetype.vim and add the following lines: augroup filetypedetect au BufNewFile,BufRead *.xt setf xt augroup END * Xdebug Documentation:

Function Traces ► Function trace files come in two formats:  Human readable (lots of options here) ► php_valuexdebug.show_mem_delta1 ► php_valuexdebug.collect_return1 ► php_value xdebug.collect_params4  Machine readable ► php_valuexdebug.trace_format1  HTML format.

XDebug Trace Options php_valuexdebug.auto_trace0 php_valuexdebug.collect_includes1 php_valuexdebug.collect_return1 php_value xdebug.collect_params4 php_valuexdebug.show_mem_delta1 php_valuexdebug.trace_options0 php_value xdebug.trace_output_dir/tmp php_valuexdebug.trace_output_nametrace.%c

Function Traces (Tips) ► Be careful when using auto_trace option for big projects. ► Files can get very big. I saw cases of >1 Gig ► Turn Off VIM syntax highlighter for very big files. ► You can also trigger start/stop of tracing via PHP.

Function Traces (Starting) ► xdebug_start_trace($filename, $options);  XDEBUG_TRACE_APPEND (1) ► makes the trace file open in append mode rather than overwrite mode  XDEBUG_TRACE_COMPUTERIZED (2) ► creates a trace file with the format as described under 1 "xdebug.trace_format". xdebug.trace_format  XDEBUG_TRACE_HTML (4) ► creates a trace file as an HTML table ► xdebug_stop_trace();

Contact Me Gennady Feldman Website: Blog: Twitter: