我发现了很多文章和帖子,即使在stackexchange网站上也是如此,我只想确定,这是最大的,我可以从xDebug
得到什么。
我的情景:
我正在localhost上开发一个wordpress网站。每当xDebug
打开时,当我想加载页面时,服务器响应为7-8秒。你可以想象,它是多么令人沮丧,当你开发时,你需要重新加载你的页面很多次。
如果我将其关闭,(从php.ini
注释掉)它会缩短到1-2秒。
你看到了什么,我在配置中做得怎么样?如果不是,您能否建议我改进服务器响应时间的任何设置?
如果它可能是3-4秒,服务器响应xDebug
,那可能很可爱。感谢。
我的环境是:
机
软件
我的xDebug配置:
output_buffering = Off
zend_extension = D:\ PHP \ ext \ php_xdebug-2.2.7-5.6-vc11-x86_64.dll
答案 0 :(得分:1)
我有一些类似的问题,所以我决定写一个小脚本来切换xdebug。
它可以帮助你或其他人......所以这里是......
#!/bin/bash
xdebugPath="/etc/php5/mods-available/xdebug.ini";
apacheRestartCommand="service apache2 restart";
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