一、安装了 xdebug

php -m  | grep 'xdebug'

如果没有安装就执行

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

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

把phpinfo()的打印信息 复制到 https://xdebug.org/wizard 下,可以得到安装信息

-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 =
xdebug.remote_connect_back =
xdebug.remote_port =
xdebug.max_nesting_level = - 保存退出

三、重启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" 配置项
  • 如果报版本错误,安装对应的版本

最新文章

  1. Google Chrome浏览器中如何使用命令
  2. ecshop的几个小瑕疵
  3. ARM堆栈及特殊指令
  4. poj1180
  5. 24篇Delphi文件操作文章
  6. DDD设计一个电商网站
  7. windows 下编译php扩展库pecl里的扩展memcache
  8. javascript执行原理
  9. java :equals()和hashcode()方法的结合使用
  10. MongoDB的mongos实例因无法分配mlock内存挂掉
  11. iOS中 UITableViewRowAction tableViewcell编辑状态下的功能 UI技术分享
  12. 【python】多进程共享变量Manager
  13. ThinkPHP设计模式与Trait技术
  14. NumsCount
  15. PYTHON-面向对象-练习-王者荣耀 对砍游戏
  16. SQLite中SELECT基本形式
  17. “无法获得锁 /var/lib/dpkg/lock -open (11:资源暂时不可用)”的方法
  18. 【springboot】之整合ActiveMQ
  19. Mac Oracle SqlDeveloper 快捷输入
  20. 关于JavaScript中name的意义冲突

热门文章

  1. 怎么新开一个组件并且配置路由?vue-cli
  2. 将Excel文件导入到Navicat Premium中日期变为0000-00-00
  3. 《Glibc内存管理》笔记DAY1
  4. javascript 的垃圾回收机制讲一下
  5. jeecg使用心得
  6. body-parser 解析post数据
  7. Ionic4.x 创建页面以及页面跳转
  8. Pytho之Django
  9. C#反射回顾笔记
  10. 查看某个进程PID对应的文件句柄数量,查看某个进程当前使用的文件句柄数量