티스토리 뷰

개요

일반적으로 개발환경에 Xdebug를 설치할 때는 yum, pecl 등의 패키지 매니저를 통해 설치한다. 하지만 부득이한 이유로 직접 컴파일하여 설치할 때도 있다. 이번 글에서는 PHP 5, 7 버전에서 Xdebug를 설치하는 방법을 설명하고자 한다.

PHP 7에서 컴파일 설치

# php: /opt/php7/bin/php
# phpize: /opt/php7/bin/phpize
# php-config: /opt/php7/bin/php-config
# php-extensions: /opt/php7/lib/php/extensions

$ cd /opt
$ git clone git://github.com/xdebug/xdebug.git
$ cd xdebug

# PHP 7은 Xdebug 2.5.4 이상 설치
$ git checkout tags/2.5.4
$ /opt/php7/bin/phpize
$ ./configure --enable-xdebug --with-php-config=/opt/php7/bin/php-config
$ make
$ cp modules/xdebug.so /opt/php7/lib/php/extensions

$ nano /opt/php7/lib/php.ini
zend_extension="/opt/php7/lib/php/extensions/xdebug.so"
xdebug.remote_autostart = 1
xdebug.remote_connect_back = 1
xdebug.remote_enable = 1
xdebug.remote_mode = req
xdebug.remote_port = 9000

# Apache httpd 재시작
$ /opt/apache/bin/apachectl restart

$ /opt/php7/bin/php -m
[PHP Modules]
xdebug

[Zend Modules]
Xdebug

PHP 5에서 컴파일 설치

# php: /opt/php5/bin/php
# phpize: /opt/php5/bin/phpize
# php-config: /opt/php5/bin/php-config
# php-extensions: /opt/php5/lib/php/extensions

$ cd /opt
$ git clone git://github.com/xdebug/xdebug.git
$ cd xdebug

# PHP 5.2, 5.3은 Xdebug 2.2.7 설치
$ git checkout tags/2.2.7
$ /opt/php5/bin/phpize
$ ./configure --enable-xdebug --with-php-config=/opt/php5/bin/php-config
$ make
$ cp modules/xdebug.so /opt/php5/lib/php/extensions

$ nano /opt/php5/lib/php.ini
zend_extension="/opt/php5/lib/php/extensions/xdebug.so"
xdebug.remote_autostart = 1
xdebug.remote_connect_back = 1
xdebug.remote_enable = 1
xdebug.remote_mode = req
xdebug.remote_port = 9000

# Apache httpd 재시작
$ /opt/apache/bin/apachectl restart

$ /opt/php5/bin/php -m
[PHP Modules]
xdebug

[Zend Modules]
Xdebug
댓글
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함