Server-Side/Linux2010. 12. 20. 17:31
인스톨
# pecl install xdebug
downloading xdebug-2.0.3.tgz ...
Starting to download xdebug-2.0.3.tgz (286,325 bytes)
...........................................................done: 286,325 bytes
66 source files, building
running: phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20060613
Zend Extension Api No:   220060519
/usr/bin/phpize: /tmp/pear/download/xdebug-2.0.3/build/shtool: /bin/sh: bad interpreter: Permission denied
Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF
environment variable is set correctly and then rerun this script.
ERROR: `phpize' failed
에러 발견!

root가 shell interpreter를 수행할 수 있는지 확인하기
# bin/sh
sh-3.2# exit
exit
#
OK!

permission 확인하기
#ls -ld /tmp/
drwxrwxrwx 17 root root 4096 Jun 18 07:41 /tmp/
OK!

mount 확인하기
# grep tmp /etc/fstab
LABEL=/tmp /tmp ext3 defaults,noexec,nodev,nosuid 1 2
tmpfs /dev/shm tmpfs defaults 0 0
이거다!
/tmp 는 'noexec' flag로 마운트가 되었다. 그래서 pecl로 xdebug를 설치할 때 실패했다.
그렇다면 pecl과 관련된 경로를 변경하자!

PEAR 경로 변경하기
# pear config-show | grep tmp
PEAR Installer download download_dir /tmp/pear/download
PEAR Installer temp directory temp_dir /tmp/

# pear config-set download_dir /root/tmp/pear/download
# pear config-set temp_dir /root/rmp

# pear config-show | grep tmp
PEAR Installer download        download_dir    /root/tmp/pear/download
PEAR Installer temp directory  temp_dir        /root/tmp/
OK!

Reinstall
# pecl install xdebug
여전히 에러가 난다!

# strace pecl install xdebug 2>&1
# cd /tmp && rm -fr pear pear-build-root
# ln -s /root/tmp/pear-build-root .     <= 마지막에 "." 이 있다!
# mkdir /root/tmp/pear-build-root
# pecl install xdebug
.
.
.
Build process completed successfully
Installing '/usr/lib64/php/modules/xdebug.so'
install ok: channel://pecl.php.net/xdebug-2.1.0
configuration option "php_ini" is not set to php.ini location
You should add "extension=xdebug.so" to php.ini
OK!

설치 확인해보기
# echo 'zend_extension="/usr/lib64/php/modules/xdebug.so"'  > /etc/php.d/xdebug.ini
# php -i | grep xdebug
/etc/php.d/xdebug.ini,
xdebug
.
.
.

OK!

module 추가하기
# vi /usr/local/apache/conf/php.ini
------------------>append<-----------------
extension=xdebug.so
---------------------------------------------
# service httpd restart
<?php phpinfo();?> 를 통해서 xdebug 모듈이 추가되었음을 확인할 수 있다.

xdebug 사용해보기
# vi /usr/local/apache/htdocs/xdebug_test.php
<?php
    
function fix_string($a)
    {
        echo 
"Called @ ".
            
xdebug_call_file().
            
":".
            
xdebug_call_line().
            
" from ".
            
xdebug_call_function();
    }

    
$ret fix_string(array('Derick'));
?>

output 확인하기
go to http://your.ip.address/xdebug_test.php
return >
Called @ /usr/local/apache/htdocs/xdebug_test.php:12 from {main}


참고 사이트
xdebug 설치(문제해결 포함)

Posted by 준피