PhpStorm에서 Xdebug 설정과 테스트

Debugging(Xdebug) with PhpStorm

이제 phpstorm에 XDebug를 설정하고 실제로 Debugging을 하도록 해봅시다.

PHP Debugger에는 XDebug와 Zend Debugger 있습니다. 우리는 앞에서 XDebug v2.1.0모듈을 설치했기(terminal:php -V 확인)때문에 앞으로 XDebug를 이용하여 디버깅하도록 하겠습니다.

1. php.ini에 remote(or local) XDebug 설정하기

  • 터미널을 열고 sudo vi /etc/php.ini 에서 [xdebug] 항목에 다음을 추가합니다

[xdebug]
zend_extension=/usr/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so

xdebug.remote_enable=true
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler=dbgp

  • 아파치를 재실행합니다.(=sudo apachectl restart 또는 시스템환경설정>공유>웹공유)

2. PhpStorm 디버그 설정 및 테스트 하기

  • PhpStorm을 실행하고 File > New Project 생성

이미지1

  • 웹루트는 /Library/WebServer/Documents 로 설정합니다.
  • Project 패널에서 New php file을 Xdebug-Test.php 로 생성하고 다음의 테스트 코드를 넣습니다.

$w = “hi, “;
echo $w;
$w = $w . “world…<br>n”;
echo $w;
$sum = 0;
for ($i=0; $i<10; $i++) {

$sum = $sum + $i;

printf(“%d t = t%d <br>n”, $i, $sum);

}

  • 지금 debug 버튼을 클릭해도 설정이 되어 있지 않기때문에 작동하지 않습니다. 아래와 같이 설정하도록 합니다.

File > Settings > PHP

Settings > PHP > Servers > Add(+아이콘 클릭)

Settings > Web Browsers > 파이어폭스(자동), 크롬(수동설정)

Apply > Ok (적용하기)

  • 이제 Xdebug-Test.php을 디버깅하기 위한 마지막 설정을 합니다.

Run > Edit Configurations > Defaults > PHP script

  • 자 디버그가 제대로 작동되었는지 확인해봅니다.

Step 아이콘이 활성화되면 디버깅이 정상적으로 작동된것입니다. Console 패널을 켜고 Step 아이콘을 클릭 한번씩 눌러보세요. 단계별로 실행되는것을 확인하실수 있습니다.

참고동영상 : http://www.jetbrains.com/phpstorm/demos/remote_debugging/remote_debugging.html

Britain’s exit from the EU could be delayed until late 2019 because the government is too “chaotic” to start the two year process early next year, the Sunday Times reported, citing sources that were briefed by ministers. “They don’t have the infrastructure for the people they need to hire. Wearing a full body costume will also make you go through a total body change: After a few weeks in costume, my sweat started to run clear. Salt just stopped coming out of my pores. One of the west coast most cheap nfl jerseys successful talk Baratas Replicas Ray Ban hosts, Tom brings integrity, life experience, intellect and likeability, as a benchmark of his show.Anchoring on the Fox Business Network places him in a unique position at a time where economic topics are important to us all, allows his business acumen to be of particular value to Fox News Talk listeners.THE ALAN COLMES SHOWWeekdays 6pm 9pm ETAlan Colmes Show is the nationally syndicated, and most interactive talk radio program on the planet, hosted by industry veteran and Colmes co host, Alan Colmes. The show offers a bold take on the news of the day, with A list guests such as Senator John Kerry, House Speaker Dennis Hastert, Former Secretary of State Madeleine Albright as well as cultural icons like Ray Romano and Charlie Daniels. That certainly had something to do with it, but not on the offensive end of the court; the Irish still finished 14th in the country in assist to turnover ratio. The primary letdown was at the defensive end, where they dropped to 245th in field goal percentage defense and a scary 334th in 3pt.% defense. Until ray ban sunglasses I cheap ray bans decide to write this article, I was under the impression that cheap oakleys sunglasses all Voodoo dolls were made to do evil. It was my further understanding that a person could be forced to do bad things, and even feel pain if their soul was attached to a doll by a black magick spell. Rather than not drink at all, students drank behind closed doors and pre gamed before Cheap NFL Jerseys heading out to parties or concerts where they knew they couldn’t consume alcohol publicly. This makes them much more likely to overdose, and much less likely to get proper medical attention if they do.. Turn your jersey inside out and sparingly pour the acetone on the area where the badge is attached. The acetone will automatically dissolve the adhesive on the badge and it will make the badge be able to roll off the shirt. Anyone that’s ever done it has been scared shtless. You stay off the Internet for the five days afterward.”. The adoption process wasn an easy one; there were considerable delays and reams of paperwork that required Julie to stay in the war torn cheap oakleys country for 10 long weeks as visas and other issues were sorted out. But now, finally, the big family are all under one roof and looking forward to their first Christmas together..