美文网首页
php使用xdebug的配置方法

php使用xdebug的配置方法

作者: yulong_vip | 来源:发表于2021-02-05 11:13 被阅读0次
    1. 在获取xdebug源码,本文示例版本为2.4.1,其它版本可在官网下载。
      https://xdebug.org/announcements
      关于xdebug与PHP的版本对应关系 ,可以使用https://xdebug.org/wizard页面查询;

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

    2.解压源码文件,并进入目录

    tar -xzvf xdebug-2.4.1.tgz 
    
    cd xdebug-2.4.1
    

    3.检测PHP环境,在xdebug-2.4.1目录中执行phpize,phpize是用来扩展php扩展模块的,通过phpize可以建立php的扩展模块,而xdebug-2.4.1就是一个PHP扩展模块;
    执行成功后可以看到当前的php api版本,扩展api版本等。

    可以通过find查找phpize所在目录:

    [root@test xdebug-2.4.1]# find / -name phpize
    /usr/bin/phpize
    [root@test xdebug-2.4.1]# 
    
    [root@test xdebug-2.4.1]# /usr/bin/phpize 
    Configuring for:
    PHP Api Version:         20090626
    Zend Module Api No:      20090626
    Zend Extension Api No:   220090626
    [root@test xdebug-2.4.1]# 
    
    1. 执行完成后,xdebug-2.4.1目录中会产生configure文件,执行configure后,再make
    ./configure --enable-xdebug
    
    make && make install
    

    5.启用PHP扩展,编辑php.ini文件,加入xdebug扩展。

    vim /etc/php.ini
    加入以下扩展配置
    extension=/usr/lib64/php/modules/xdebug.so 
    

    重启Apache服务后输出phpinfo信息,如果能找到xdebug,就说明扩展生效了。

    6.php.ini配置,在php.ini中添加如下配置信息

    [Xdebug]
    zend_extension ="/usr/lib64/php/modules/xdebug.so"
    xdebug.profiler_enable=on
    xdebug.trace_output_dir="/usr/local/php/xdebug/"
    xdebug.profiler_output_dir="/usr/local/php/xdebug/"
    xdebug.profiler_output_name = "cachegrind.out.%t.%p"
    xdebug.remote_enable=on
    xdebug.show_local_vars=1
    xdebug.idekey = PHPSTROM
    xdebug.remote_handler = "dbgp"
    xdebug.remote_mode = "req"
    xdebug.remote_host = 远程调试PC的IP地址
    xdebug.remote_port = 9000
    xdebug.remote_autostart = off
    

    7.PhpStorm配置


    配置调试服务器1
    服务器目录及本地目录
    PhpStorm Debug设置1
    PhpStorm Debug设置2

    相关文章

      网友评论

          本文标题:php使用xdebug的配置方法

          本文链接:https://www.haomeiwen.com/subject/xyewtltx.html