четверг, 17 марта 2011 г.

Configure xDebug with Zend Studio or Eclipse IDE

system: gentoo | php: 5.3.3 | xdebug: 2.0.5

1. Install xdebug: emerge dev-php/xdebug-client -av
2. Edit php.ini: Include xdebug configuration file in php.ini.
    • create and put xdebug.ini file in directory: /etc/php/apache2-php5/ext/
    • create soft link: ln -s /etc/php/apache2-php5/ext/xdebug.ini /etc/php/apache2-php5/ext-active/
    •  xdebug.ini file content:  
    [xdebug]
    zend_extension=/usr/lib/php5/lib/extensions/no-debug-zts-20090626/xdebug.so
    xdebug.auto_trace="0"
    xdebug.trace_output_dir="/tmp"
    xdebug.trace_output_name="trace.%c"
    xdebug.trace_format="0"
    xdebug.trace_options="0"
    xdebug.collect_includes="1"
    xdebug.collect_params="0"
    xdebug.collect_return="0"
    xdebug.collect_vars="0"
    xdebug.default_enable="0"
    xdebug.extended_info="1"
    xdebug.manual_url="http://www.php.net"
    xdebug.max_nesting_level="100"
    xdebug.show_exception_trace="0"
    xdebug.show_local_vars="0"
    xdebug.show_mem_delta="0"
    xdebug.dump.COOKIE="NULL"
    xdebug.dump.ENV="NULL"
    xdebug.dump.FILES="NULL"
    xdebug.dump.GET="NULL"
    xdebug.dump.POST="NULL"
    xdebug.dump.REQUEST="NULL"
    xdebug.dump.SERVER="NULL"
    xdebug.dump.SESSION="NULL"
    xdebug.dump_globals="1"
    xdebug.dump_once="1"
    xdebug.dump_undefined="0"
    xdebug.profiler_enable="0"
    xdebug.profiler_output_dir="/tmp"
    xdebug.profiler_output_name="cachegrind.out.%p"
    xdebug.profiler_enable_trigger="0"
    xdebug.profiler_append="0"
    xdebug.profiler_aggregate="0"
    ;xdebug.remote_enable="0"
    xdebug.remote_enable=On
    xdebug.remote_handler="dbgp"
    xdebug.remote_host="localhost"
    xdebug.remote_mode="req"
    ;xdebug.remote_port="9000"
    xdebug.remote_port=9000
    xdebug.remote_autostart="0"
    ;xdebug.remote_log=""
    xdebug.remote_log="/var/www/xdebug.log"
    xdebug.idekey=""
    xdebug.var_display_max_data="512"
    xdebug.var_display_max_depth="2"
    xdebug.var_display_max_children="128"
    3. Check  phpinfo(). If all OK, you will see  "xdebug section"
    4. Configure Zend Studio.
    • Open your project in Zend Studio
    • In the main menu select Project->Properties
    • On the left side of the window select "PHP Debug" and then click on "Configure Workspace Settings"
    • On the "PHP Debugger" dropdown select Xdebug and click "Apply"
    • Click "Configure" to the right of Xdebug in the same window.
    • Select Xdebug and click "Configure".
    • On the "Accept remote session(JIT)" select "any" and click "OK". This is extremely important and this is where most people get stuck.
    5. Debug!!! :)

    very helpfull for me!

    1 комментарий: