2
votes

I've found many articles, and posts about this, even on stackexchange sites, I'd just like want to be sure, is it the max, what I can get from xDebug.

My scenario:

I am developing a wordpress site on localhost. Every time, when xDebug is on, when I want to load a page, the server response is 7-8 seconds. You can imagine, how frustrating it is, when you develop, and you need to reload your pages a lot of times.

If I am turn it off, (comment out from php.ini) it goes down to 1-2 seconds.

Do you see anything, what I did set badly in my configuration? If no, can you suggest me any settings what improve the speed of the server response time?

If it could be 3-4 sec, a server response with xDebug, that could be lovely. Thanks.

My environment is:

Machine

  • IBM Thinkpad T410 i5 CPU 2.40Ghz
  • 8GB RAM
  • 64 Bit
  • Windows 7 Ultimate 64bit SP1

Softwares

  • Apache/2.4.2 (Win64) OpenSSL/1.0.1c
  • PHP Version 5.6.5 x64
  • 10.0.16-MariaDB (MySql fork)

My xDebug configuration:

  • zend.enable_gc = On
  • report_zend_debug = 0
  • output_buffering = Off

  • zend_extension = D:\PHP\ext\php_xdebug-2.2.7-5.6-vc11-x86_64.dll

  • xdebug.remote_enable=1
  • xdebug.remote_host=127.0.0.1
  • xdebug.remote_autostart = 0
  • xdebug.remote_connect_back = 0
  • xdebug.profiler_enable = 0
  • xdebug.remote_mode=req
  • xdebug.remote_port=9000
  • xdebug.remote_handler=dbgp
  • xdebug.overload_var_dump = 1;
  • xdebug.cli_color = 2
  • xdebug.show_exception_trace=1
  • xdebug.auto_trace=1
  • xdebug.var_display_max_children = -1
  • xdebug.var_display_max_data = -1
  • xdebug.var_display_max_depth = -1
1
What are you actually using xdebug for? It's a debugging utility. Execution speed should not be important when you're debugging, When you're not debugging, you don't need to use xdebug - Mark Baker
It could seems intresting, but I am using xdebug for debugging. I do not want always comment out, and remove comments from my php.ini, and restart apache. I am using Netbeans and Firefox Developer Edition. When no debug started in Netbeans, and no debug started in FF, it's slow also, this is my problem. When I comment out the xdebug, then it turns to fast. - vaso123
Might be a windows thing? I've never seen performance that poor just from having xdebug enabled. - Sam Dufel
It is probably a windows thing. At least two developers in my company suffer from bad performance with xdebug enabled... appeared after upgrade to 5.6 on Win 8.1 and Win 10. There is a bugreport bugs.xdebug.org/view.php?id=1177 - Tomáš Fejfar

1 Answers

2
votes

I've had some similar problems, so I decided to write a little script to toggle Xdebug.

May it helps you or others... so here it is..

#!/bin/bash

xdebugPath="/etc/php5/mods-available/xdebug.ini";
apacheRestartCommand="service apache2 reload";

showUsageMessage(){
        echo "Usage: xdebug {on|off|status}";
}

enableDebugger(){
        printf "Enabling X-debug...\r\n";
        sed  -i -e "s/^;xdebug/xdebug/g" "${xdebugPath}";
        sed  -i -e "s/^;zend/zend/g" "${xdebugPath}";
        printf "Restarting Apache...\r\n";
        ${apacheRestartCommand};
        printf "Done\r\n\r\b";
}

disableDebugger(){
        printf "Disabling X-debug\r\n";
        sed -i -e "s/^xdebug/;xdebug/g" "${xdebugPath}";
        sed -i -e "s/^zend/;zend/g" "${xdebugPath}";
        printf "Restarting Apache...\r\n";
        ${apacheRestartCommand};
        printf "Done\r\n\r\n"
}

showStatus(){
        status=$(getStatus);
        if [[ ${status} = 1 ]]; then
                echo "X-debug seems to be enabled";
        else
                echo "X-debug seems to be disabled";
        fi
}

getStatus(){
        local __result=1

        while IFS="" read -r line || [[ -n "$line" ]]; do
                if [[ ${line} == ";"* ]]; then
                        __result=0;
                fi
        done < ${xdebugPath}

        echo "$__result";
}

if [ $# = 1 ]; then
    if [ $1 == "on" ];then
    enableDebugger;
    elif [ $1 == "off" ];then
        disableDebugger;
    elif [ $1 == "status" ];then
        showStatus;
    else
        showUsageMessage;
    fi
else
    showUsageMessage;
fi

Save the text above in a new file named xdebug and mark it as executable: chmod +x xdebug.