Develop

centos 7.9 / php 7.3 / xdebug 3.1.5 세팅

Y.J Kim 2022. 7. 26. 13:28

오늘의 삽질을 까먹지 않기 위해.

 

출처:  https://www.lesstif.com/php-and-laravel/windows-rhel-centos-xdebug-phpstorm-20775640.html

 

Windows RHEL/CentOS 리눅스에 xdebug 설치 및 PHPStorm 연동

remote_port 의 기본 값은 9000 이지만 php-fpm 기본 포트와 충돌하므로 다른 값으로 변경한다.

www.lesstif.com

https://xdebug.org/wizard

 

Xdebug: Support — Tailored Installation Instructions

Installation Wizard This page helps you finding which file to download, and how to configure PHP to get Xdebug running. Please paste the full output of phpinfo() (either a copy & paste of the HTML version, the HTML source or php -i output) and submit the f

xdebug.org

 

에서 현재 php에 맞는 xdebug버전을 알려줌.

 

php -i 로 해서 나오는것을 전부 복붙해서 확인. 

나 같은 경우는 xdebug 3.1.5!

 

xdebug 3.1.5를 다운받아 설치. 위 페이지에서 설치과정도 다 알려줌..

 

vi /etc/php.d/99-xdebug.ini

> zend_extension = xdebug

 

vi /etc/php.ini 하단에

> xdebug.start_with_request=yes
> xdebug.mode=debug
> xdebug.client_host=127.0.0.1

 

이후 nginx, php-fpm 재시작

 

php -i 나 phpinfo()로 설치된것 확인.

 

 

phpstorm 설정에 들어가서 

PHP탭에서 php 버전, 인터프리터 설정함.

디버그 탭에서 포트(9003) 설정

 

https://www.jetbrains.com/help/phpstorm/2022.1/remote-debugging-via-ssh-tunnel.html#prepare-the-debugging-engine

 

Remote debugging via SSH tunnel | PhpStorm

 

www.jetbrains.com

xdebug 2.x와 3.x 에서 많은게 바껴서 여길보고 참고하였다.

 

phpstorm 터미널을 열고

> ssh -R 9003:localhost:9003 username@hostname -p <port>

 

이후 위의 디버그 연결 리스닝을 누르고, 

postman으로 호출시 잡히는것을 확인.

 

 

빠진게 있을까..