ubuntu 安装php xdebug

windows 安装xdebug https://www.jetbrains.com/help/phpstorm/configuring-xdebug.html

一.下载

下载与PHP版兼容的Xdebug扩展,并将其保存在php /文件夹中。

php /文件夹 的位置是在PHP引擎安装期间定义的。

如果您使用的是AMP软件包,则可能已安装Xdebug扩展。按照xdebug.txt中的说明进行操作

二. 将Xdebug与PHP解释器集成 在php.in加入

[XDebug]
zend_extension="php_xdebug.dll"
xdebug.idekey = PHPSTORM
xdebug.show_error_trace = 1
;指定Xdebug扩展文件的绝对路径
;启用性能检测分析  
xdebug.profiler_enable=On
;启用代码自动跟踪  
xdebug.auto_trace=on
;允许收集传递给函数的参数变量  
xdebug.collect_params=On
;允许收集函数调用的返回值  
xdebug.collect_return=On
;指定堆栈跟踪文件的存放目录 
xdebug.trace_output_dir="C:\phpStudy\PHPTutorial\tmp\xdebug"
xdebug.profiler_output_dir="C:\phpStudy\PHPTutorial\tmp\xdebug"
xdebug.remote_enable = On
xdebug.remote_port=9000
xdebug.remote_handler = dbgp
xdebug.remote_host = localhost
xdebug.var_display_max_depth = 10

 

 

liunux安装php xdebug

http://xdebug.org/install.php#configure-php 
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  

 

一、下载并编译 xdebug

下载 xdebug 最新的源码包

wget https://xdebug.org/files/xdebug-2.6.0.tgz

 

解压缩

tar -zxvf xdebug-2.6.0.tgz

编译安装

cd xdebug-2.6.0
phpize
./configure  --enable-xdebug 
make
make install

三、配置

  • /etc/php/7.2/mods-available/xdebug.ini加入

  • zend_extension=xdebug.so
    extension=xdebug.so
    xdebug.remote_enable = 1
    xdebug.remote_port = 9000
    xdebug.idekey = PHPSTORM
    xdebug.show_error_trace = 1
    xdebug.remote_autostart = 1
    xdebug.file_link_format = phpstorm://open?%f:%l

     

  • 在php.ini中增加xdebug配置 xdebug.so路径 在安装完xdebug时控制台会有提示
[xdebug]
zend_extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
#xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.idekey=PHPSTORM
#idekey=PHPSTORM
;注意这个autostart很关键,我就是加了这个才跑起来的
xdebug.remote_autostart=1
xdebug.remote_log=/var/xdebug.log
  • 增加软连接  //一下配置我并没有使用
cd /etc/php/7.2/fpm/conf.d/
sudo ln -s /etc/php/7.2/mods-available/xdebug.ini 20-xdebug.ini
cd /etc/php/7.2/cli/conf.d/
sudo ln -s /etc/php/7.2/mods-available/xdebug.ini 20-xdebug.ini

 重启apache,检测是否安装成功:

$ sudo apachectl restart
$ php -m | grep xdebug

 

四、测试

  1. cli 环境下,查看 php -m
  2. 测试 phpinfo,查看 xdebug 的信息 (略)
  3. phpstorm 测试 xdebug

转载于:https://www.cnblogs.com/jiangfeilong/p/11163117.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值