dsndm82062 2016-08-04 20:10
浏览 52
已采纳

xdebug在ubuntu 16.04的laravel项目中使用sublimetext 3

I'm moreless new with this kind of things, I'm trying to setup xdebug to debug a laravel project I'm developing in my Ubuntu 16.04, I have installed sublime text with the package control and the xdebug client, I installed from apt-get the packages

php (7.0) php-xdebug php-all-dev php-fpm

the laravel project already works with the comand

php artisan serve

I saved the sublime text 3 project with the code

{
    "folders":
    [
        {
            "follow_symlinks": true,
            "path": "."
        }
    ],
    "settings": {
        "xdebug": {
             "url": "http://localhost/",
        }
    }
}

my /etc/php/7.0/fpm/conf.d/20-xdebug.ini is:

zend_extension=xdebug.so
xdebug.remote_enable = 1
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_port = 8000
xdebug.remote_log="/var/log/xdebug/xdebug.log"

I dont know if I need to use the "php artisan" to debug or just with the xdebug plugin in sublime text, nothing apear to work

any ideas?

thanks for everything

展开全部

  • 写回答

1条回答 默认 最新

  • duandong1963 2016-08-05 05:48
    关注

    Here is my config for xdebug:

    zend_extension=/usr/lib/php/modules/xdebug.so
    xdebug.remote_enable=on
    xdebug.remote_host=127.0.0.1
    xdebug.remote_port=9000
    xdebug.idekey="netbeans-xdebug"
    xdebug.remote_autostart=1
    

    Note the remote_autostart, which made all my debugging work correctly.

    I don't use sublime, but this config worked correctly in Atom, PhpStorm, VSCode and Netbeans, and I assume it will work virtually for all compatible debugger clients. Make sure that the port, host and idekey fields are the same in sublime and your config file, that's all.

    The thing is, you have to know how xdebug works. Then you can set it up everywhere easily.

    xdebug works but connecting to the remote_host and remote_port you specify in its config. That means, when a PHP script is going to be executed, first, if loaded, xdebug tries to connect to that address. If a compatible debugger is listening on the other side, then connection is made, and the debugger can do its debugging. Note that, xdebug, as in sockets terminology, is a client to your server (ide, debugger, ...). So your ide must be listening first, before PHP script is executed. In sublime, find something like listening for connections.

    For debugging if problem is with your ide or xdebug itself, you can use debugclient, a tool that acts as a server for xdebug. Just run debugclient and execute a PHP script, with xdebug loaded (which seems you have it). If it shows that connection is made, than sublime has a configuration problem. If not, check xdebug config again, and make sure everything is ok.

    I have seen systems where debugclient is not installed by default. You can also test with nc -l 9000 or whatever port to test it too.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

悬赏问题

  • ¥15 图片是GET请求,后面是图片的id,Glide如何缓存?
  • ¥15 现代密码学问题求解答
  • ¥15 关于C#与NICAN类库通信的问题
  • ¥15 cytoscape问题
  • ¥15 putty实现机器学习猫狗识别
  • ¥15 STS/eclipse导入gradle项目时报错如下
  • ¥15 centos7.6进不去系统,卡在数字7界面
  • ¥15 Tensorflow采用interpreter.allocate_tensors()分配内存出现ValueError: vector too long报错
  • ¥15 使用CGenFF在线生成血红素辅基拓扑结构遇到问题
  • ¥20 matlab代码实现可达矩阵形成骨骼矩阵
手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部