Ubuntu 编译安装 Xdebug

安装xdebug

1、下载

https://xdebug.org/download.php

找到PHP5.6对应的版本

https://xdebug.org/files/xdebug-2.5.5.tgz

2、解压

sudo tar -zvxf xdebug-2.5.5.tgz -C /usr/local

3、进入

cd /usr/local/xdebug-2.5.5/

4、phpize

# sudo /usr/local/php/bin/phpize
Configuring for:
PHP Api Version:         20131106
Zend Module Api No:      20131226
Zend Extension Api No:   220131226

5、配置

sudo ./configure --enable-xdebug --with-php-config=/usr/local/php/bin/php-config

6、安装

sudo make 
sudo make test
sudo make install

需要打开proc_open,shell_exec

$ sudo make test

Build complete.
Don't forget to run 'make test'.


=====================================================================
PHP         : /usr/local/php/bin/php 
PHP_SAPI    : cli
PHP_VERSION : 5.6.36
ZEND_VERSION: 2.6.0
PHP_OS      : Linux - Linux JQ-Mac 4.15.0-45-generic #48~16.04.1-Ubuntu SMP Tue Jan 29 18:03:48 UTC 2019 x86_64
INI actual  : /usr/local/xdebug-2.5.5/tmp-php.ini
More .INIs  :  
CWD         : /usr/local/xdebug-2.5.5
Extra dirs  : 
VALGRIND    : Not used
=====================================================================
TIME START 2019-03-21 13:44:30
=====================================================================
No tests were run.
$ sudo make install
Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/

  +----------------------------------------------------------------------+
  |                                                                      |
  |   INSTALLATION INSTRUCTIONS                                          |
  |   =========================                                          |
  |                                                                      |
  |   See http://xdebug.org/install.php#configure-php for instructions   |
  |   on how to enable Xdebug for PHP.                                   |
  |                                                                      |
  |   Documentation is available online as well:                         |
  |   - A list of all settings:  http://xdebug.org/docs-settings.php     |
  |   - A list of all functions: http://xdebug.org/docs-functions.php    |
  |   - Profiling instructions:  http://xdebug.org/docs-profiling2.php   |
  |   - Remote debugging:        http://xdebug.org/docs-debugger.php     |
  |                                                                      |
  |                                                                      |
  |   NOTE: Please disregard the message                                 |
  |       You should add "extension=xdebug.so" to php.ini                |
  |   that is emitted by the PECL installer. This does not work for      |
  |   Xdebug.                                                            |
  |                                                                      |
  +----------------------------------------------------------------------+

7、配置php.ini

[Xdebug]
zend_extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so
xdebug.auto_trace = on
xdebug.default_enable = on
xdebug.auto_profile = on
xdebug.collect_params = on
xdebug.collect_return = on
xdebug.profiler_enable = on
xdebug.remote_host = "127.0.0.1"
xdebug.remote_port = 9100
xdebug.remote_handler = dbgp
xdebug.trace_output_dir = "/usr/local/php/xdebug/"
xdebug.profiler_output_dir = "/usr/local/php/xdebug/"

8、重启lnmp

sudo lnmp restart

9、查看

$ php -moudle
[PHP Modules]
bcmath
Core
ctype
curl
date
dom
ereg
filter
ftp
gd
gettext
hash
iconv
intl
json
libxml
mbstring
mcrypt
mhash
mysql
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
redis
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
sysvsem
tokenizer
xdebug
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend Guard Loader
zip
zlib

[Zend Modules]
Xdebug
Zend Guard Loader

查看phpinfo

猜你喜欢

转载自www.cnblogs.com/jiqing9006/p/10571238.html