KimsFactory*

PHP xdebug 설치 및 Visual Studio Code 설정하고 연동하기 본문

Develop

PHP xdebug 설치 및 Visual Studio Code 설정하고 연동하기

KimsFactroy 2017. 3. 23. 16:56

php 디버깅 환경 만들기~


[xdebug 설치 확인]

$ php -m | grep xdebug


[php 버전확인]

$ php -v

PHP 5.3.10-1ubuntu3.25 with Suhosin-Patch (cli) (built: Oct  3 2016 17:02:21)
Copyright (c) 1997-2012 The PHP Group

[xdebug 설치]

$ apt-get install php5-xdebug


[xdebug 설정]

$ vi /etc/php5/conf.d/xdebug.ini

zend_extension=/usr/lib/php5/20090626/xdebug.so
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_host=192.168.33.1
xdebug.remote_port=9000


빨간색 부분 추가 해주자!

xdebug.remote_host는 로컬 아이피로 설정 ($_SERVER['REMOTE_ADDR'] 찍어서 나오는 아이피 입력)

[아파치 재시작]
$ /etc/init.d/apache2 restart


[xdebug 설치 확인]
$ php -, | grep xdebug
xdebug


[Visual Studio Code  설정]
왼쪽 디버그 버튼을 누르고 구성없음 셀렉트 박스를 누르고 PHP debug 설치



[설정 추가]

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9000,
            "localSourceRoot": "${workspaceRoot}/",
            "serverSourceRoot": "/Server Document Root"
        }
    ]
}


serverSourceRoot 를 서버 경로와 에디터 경로로 맞춰서 변경!!


이제 누려보자;;;;




'Develop' 카테고리의 다른 글

[Vagrant] 공유폴더 퍼미션 조정  (0) 2017.02.14
Comments