首页 > 系统服务 > 详细

linux 安装xdebug

时间:2019-12-23 17:41:15      阅读:77      评论:0      收藏:0      [点我收藏+]

一、安装了 xdebug

php -m  | grep xdebug

 如果没有安装就执行

首先根据 phpinfo() 信息 下载对应的版本,具体看参数:

下载地址:https://xdebug.org/download

 

-1.下载xdebug
wget https://xdebug.org/files/xdebug-2.7.0.tgz

-2.解压
tar -zxvf xdebug-2.7.0.tgz
cd xdebug-2.7.0

-3.运行phpize,通过phpize可以 生成 configure 文件,动态的添加php扩展
phpize 或者 /usr/bin/phpize7.2

-4. 配置,--with-php-config=/你php的bin路径/php-config
./configure --enable-xdebug --with-php-config=/usr/bin/php-config7.2

-5.编译&生成
make && make install

编译&&生成后,屏幕上会有输出

installing shared extensions:     /usr/lib/php/20170718/

+----------------------------------------------------------------------+
| |
| 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. |
| |
+----------------------------------------------------------------------+

编译安装完成后会有一个 modules文件夹,该文件夹下有一个xdebug.so的文件,将此文件复制到对应PHP版本的扩展目录即可。当然,如果PHP已经设置了扩展目录地址,该文件就会自动复制到了扩展目录中,

如:我的扩展目录是  /usr/lib/php/20170718/ ,目录下面会生成一个 xdebug.so 的动态库文件

说明:  /usr/lib/php/20170718/ 该目录是存放PHP扩展的目录,phpinfo()里看到 extension_dir 该属性的值。

二、PHP 配置文件添加配置

vim /usr/local/php/etc/php.ini
 
- 添加
zend_extension=xdebug.so # 这里没有写绝对路径,是因为会到扩展目录中去找
xdebug.remote_enable = 1
xdebug.remote_connect_back = 1
xdebug.remote_port = 9900
xdebug.max_nesting_level = 512

- 保存退出

 

三、重启PHP

service php-fpm restart

 

四、查看

通过 phpinfo() 输出查看,或者 通过命令 php -m | grep ‘xdebug‘

 

注意事项

  • 如果配置时出现"configure: error: Cannot find PHP-config. Please use --with-PHP-config=PATH"错误,增加" --with-php-config=/usr/local/php/bin/php-config" 配置项
  • 如果报版本错误,安装对应的版本



linux 安装xdebug

原文:https://www.cnblogs.com/echojson/p/12084183.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!