XDebug - if during debugging you are tired of echo (), var_dump () and print_r (). Part 2.

    The first part

    The official website for the project - www.xdebug.org
    Settings, in parentheses the version (for example, Xdebug 2) - www.xdebug.org/docs-settings.php
    Documentation - www.xdebug.org/docs.php

    Installing XDebug2 under the Windows

    1. Download the extension under the desired PHP version:
    - PHP 4.4.1+
    - PHP 5.1.2+
    - PHP 5.2.1+

    2. The right to the php.ini:
    ; path to the downloaded extension (specify your own). if it does not work, replace zend_extension_ts with extension
    zend_extension_ts = "C: \ program files \ php \ extensions \ php_xdebug.dll"
    ; enable / disable profiling (1/0)
    xdebug.profiler_enable = 1
    ; directory for profiling results (default)
    xdebug.profiler_output_dir = "c: \ program files \ php \ tmp_xdebug"

    Data on the script execution is written to the cachegrind file (text file). These files are read perfectly by WinCacheGrind .

    Installing XDebug2 under the Linux

    1. Download the source code
    2. Rules the php.ini:
    ; enable / disable profiling (1/0)
    xdebug.profiler_enable = 1
    ; directory for profiling results (default)
    xdebug.profiler_output_dir = "/ data / home / user / projects / tmp_xdebug"
    3. Next we smoke the manual :)

    XDebug setup

    If you have one project you are working on, thenXDebug directives can be written in the php.ini file. They will act on all projects on your web server.

    If you need to configure XDebug individually for each project, then use php_value in the .htaccess (Apache) file.

    Setting example:
    # Change the path to the log to your own (+ create a directory for the log)

    # path to the gully XDebug
    php_value xdebug.profiler_output_dir / data / home / user / your_project / tmp_xdebug

    #php_value xdebug.trace_output_dir / data / home / user / your_project / tmp_xdebug

    # plug auxiliary file for vindovyh utility WinCacheGrind (outputs profile-log)
    # At When debugging, in the browser address bar, enter the GET parameter? XDEBUG_PROFILE (http: // yourhost /? XDEBUG_PROFILE). Open result WinCacheGrind'om
    php_value php_value auto_prepend_file /data/home/user/your_project/Debug.class.php

    #
    autotracing off php_flag xdebug.auto_trace 0

    # important option. If 1 - the log will be saved, if 0 - it is issued with the GET parameter XDEBUG_PROFILE (http: // yourhost /? XDEBUG_PROFILE)
    php_flag xdebug.profiler_enable 0

    php_flag xdebug.profiler_enable_trigger 1

    # collect parameters, return values, variables (0 - off, 1 - on)
    #php_flag xdebug.collect_params 0
    #php_flag
    xdebug.collect_retag 0debp 0

    # php , 1 - turns on
    #php_flag xdebug.default_enable 1
    # show in memory the memory usage between function calls
    php_flag xdebug.show_mem_delta 1

    # 1 - human-readable output of the
    php_flag log xdebug.trace_format 0

    #timestamp - the second format of the output file
    name #php_tcue_value xdebout_cress xvalue

    xpoutvalue xoutbout_value xdebug.profiler_output_name pid



    Full list of settings .



    An auxiliary file for receiving the profile log via the GET parameter and viewing WinCacheGrind ( download ), the original code was taken a year ago from the dklab forum


    Also popular now: