Giter Club home page Giter Club logo

Comments (27)

gotys avatar gotys commented on May 26, 2024 2

I confirm that YASD works with PhpStorm 2020.3 , with breakpoints and everything.
If you want your breakpoints to work , you have to set your IDE for remote file mappings.

Tested with phpswoole/swoole:4.6.4-php8.0 inside Docker

xdebug

from yasd.

hq9000 avatar hq9000 commented on May 26, 2024 1

okay.

The php-side setup

  1. I'm running my php app in docker, the complete Dockerfile: https://gist.github.com/hq9000/f2fbb8dcf6a2a3799615064f2f9c5b5e
  2. I run the container with "host" networking and volume mapping that preserves path to my php files: /home/me -> /home/me
  3. the configuration reported by php is as follows:
root@sergey-Aspire-A315-53G:/# php --ri yasd  

yasd

Yasd => enabled
Author => codinghuang <[email protected]>
Version => 0.3.7
Built => Mar  2 2021 15:56:17

Directive => Local Value => Master Value
yasd.breakpoints_file => no value => no value
yasd.debug_mode => remote => remote
yasd.remote_host => 127.0.0.1 => 127.0.0.1
yasd.remote_port => 9337 => 9337
yasd.depth => 1 => 1
yasd.log_level => -1 => -1
yasd.max_executed_opline_num => 0 => 0
yasd.init_file => no value => no value
xdebug.coverage_enable => 1 => 1
xdebug.profiler_enable => 1 => 1
xdebug.remote_autostart => 1 => 1
xdebug.remote_connect_back => 0 => 0
xdebug.remote_mode => req => req

root@sergey-Aspire-A315-53G:/# php -a
Interactive shell

php > print swoole_version();
4.6.3

Phpstorm-side setup

phpstorm version: 2020.1 (bit old)

configuration of the "interpreter":
image

I have a simple script where i have set breakpoints at each and every line:
image

run configuration:
image

debug settings:
image

Expectation

in the setup above, I was expecting to have the first breakpoint hit when clicking here:
image

however, it does not happen

if i click on the "bug" icon instead, it gets me this:
image

running a container from that image, i can confirm that it can reach the phpstorm's port:
image

from yasd.

hq9000 avatar hq9000 commented on May 26, 2024 1

also i tried to enable some log by setting yasd.log_level = 3, the setting was applied:
image

but i dont' see any yasd-related logs appearing. Maybe i just don't know where to look for them.

from yasd.

superdav42 avatar superdav42 commented on May 26, 2024 1

Anyone get PhpStorm and YASD to work without using docker? I just compiled yasd 0.3.7 manually and would expect it to work without needing to map any paths. It's connecting to PhpStorm just not stopping and any of the breakpoints set. Same results using master branch.

 php --ri yasd

yasd

Yasd => enabled
Author => codinghuang <[email protected]>
Version => 0.3.7
Built => Mar 23 2021 13:16:05

Directive => Local Value => Master Value
yasd.breakpoints_file => no value => no value
yasd.debug_mode => remote => remote
yasd.remote_host => 127.0.0.1 => 127.0.0.1
yasd.remote_port => 9000 => 9000
yasd.depth => 1 => 1
yasd.log_level => 3 => 3
yasd.max_executed_opline_num => 0 => 0
xdebug.coverage_enable => 1 => 1
xdebug.profiler_enable => 1 => 1
xdebug.remote_autostart => 1 => 1
xdebug.remote_connect_back => 0 => 0
xdebug.remote_mode => req => req

NetBeans debug config just like shown above and release 2020.3.3.
I am invoking with -e like php -e test.php

What could the problem be? Is there any more resources like debug logs I can use to troubleshoot this? It seems PhpStorm is not passing the breakpoints correctly to yasd but I don't know where to begin to correct it.

from yasd.

juslintek avatar juslintek commented on May 26, 2024

And as expected it doesn't work with phpstorm ide so it renders it kind of usless. That command line debugging too time consuming.

from yasd.

huanghantao avatar huanghantao commented on May 26, 2024

Your test environment is not initialized well, you can look at YASD's CI:

https://github.com/swoole/yasd/actions

from yasd.

hq9000 avatar hq9000 commented on May 26, 2024

so is it expected to work with phpstorm or not?

I'm also unable to get it stop on breakpoints.

@huanghantao

from yasd.

juslintek avatar juslintek commented on May 26, 2024

Even if tests pass probably they do not cover actual PHPStorm behaviour. Because I cannot make a breakpoint with this extension as well. I enable that yasd would send debug requests on evey request from docker php:alpine. But it seems phpstorm ignore everything send from yasd or yasd is not sending, haven't configured logs for it to see if there is connectivity issue. But with same image, but xdebug 3 installed with xdebug.mode=debug works without any problems, unless I enable swoole extension. :D

from yasd.

hq9000 avatar hq9000 commented on May 26, 2024

Btw, it's said it supports vscode. Any luck with that one?

from yasd.

huanghantao avatar huanghantao commented on May 26, 2024

Yasd supports vscode and phpstorm. Maybe you should show me how you configure yasd?

from yasd.

huanghantao avatar huanghantao commented on May 26, 2024

First, click the "Listen" button instead of "Run" button:

image

Second, execute your script with -e option, for example:

php -e test.php

image

Then, it will trigger breakpoint:

image

image

from yasd.

hq9000 avatar hq9000 commented on May 26, 2024

yes, the thing was that i forgot to use "-e"
now it works thank you.

this pic i'll put into a readme update i will PR shortly

image\

image

from yasd.

huanghantao avatar huanghantao commented on May 26, 2024

@hq9000 Thank you!

from yasd.

juslintek avatar juslintek commented on May 26, 2024

Okay on my side setup is like that:
image
image
image

But when I enable swoole and yasd with above configurations, and run instead of php artisan server in docker laravels server. It does not work. I use same port as xdebug.

Do I still need to enable web cookie listening? Even if I run custom PHP Remote Debug script?

@hq9000 are you using PHP8?

Okay will try running laravels with php -e :-)

from yasd.

hq9000 avatar hq9000 commented on May 26, 2024

@juslintek i use php 7.4.
and, as i run in in CLI, so can't really comment about cookies and stuff.

from yasd.

huanghantao avatar huanghantao commented on May 26, 2024

@juslintek Yasd is not xdebug or sdebug, so you cannot use yasd in the same way as xdebug. The use of yasd is very easy, just click the listen button of phpstorm, and then execute php with -e. Don't need to configure cookies etc.

Do you use a virtual machine or container, and, you need to show me how you configure yasd:

php --ri yasd

from yasd.

huanghantao avatar huanghantao commented on May 26, 2024

@juslintek Can you debug the test.php file in the yasd directory?

from yasd.

juslintek avatar juslintek commented on May 26, 2024

@huanghantao yes.

from yasd.

juslintek avatar juslintek commented on May 26, 2024

Okay actually I lied, I haven't tried, when I tried with file like this:

<?php

echo "test";

$something = "black";

if ($something === "black") {
    echo true;
}

I even checked break at first line. And nothing helped. I've ran from inside alpine php docker container on which I've compiled yasd with swoole.

so I run:

php -e test.php

and IDE is not opening debug inspection view...

from yasd.

juslintek avatar juslintek commented on May 26, 2024

Guess I'll just go back to sdebug and wait for it to support php8, then upgrade to it. :-( As well tried to map 9000 port via docker to 9000. And I've got this error:

2021-03-05 01:29:07,497 INFO spawned: 'swoole' with pid 22
[yasd] recv command error, connection closed
2021-03-05 01:29:07,550 INFO exited: swoole (exit status 0; not expected)
Horizon started successfully.
2021-03-05 01:29:10,528 INFO spawned: 'swoole' with pid 30
[yasd] recv command error, connection closed
2021-03-05 01:29:10,573 INFO exited: swoole (exit status 0; not expected)
2021-03-05 01:29:13,580 INFO spawned: 'swoole' with pid 43
[yasd] recv command error, connection closed

Guess it doesn't matter because php is sending package from anywhere it is executed to target server deubg listener.

from yasd.

juslintek avatar juslintek commented on May 26, 2024

So final result of YASD is that it is not working with PHPStorm 2020.3.2 and latest Early Access, while using Docker.

from yasd.

juslintek avatar juslintek commented on May 26, 2024

Anyone get PhpStorm and YASD to work without using docker? I just compiled yasd 0.3.7 manually and would expect it to work without needing to map any paths. It's connecting to PhpStorm just not stopping and any of the breakpoints set. Same results using master branch.

 php --ri yasd

yasd

Yasd => enabled
Author => codinghuang <[email protected]>
Version => 0.3.7
Built => Mar 23 2021 13:16:05

Directive => Local Value => Master Value
yasd.breakpoints_file => no value => no value
yasd.debug_mode => remote => remote
yasd.remote_host => 127.0.0.1 => 127.0.0.1
yasd.remote_port => 9000 => 9000
yasd.depth => 1 => 1
yasd.log_level => 3 => 3
yasd.max_executed_opline_num => 0 => 0
xdebug.coverage_enable => 1 => 1
xdebug.profiler_enable => 1 => 1
xdebug.remote_autostart => 1 => 1
xdebug.remote_connect_back => 0 => 0
xdebug.remote_mode => req => req

NetBeans debug config just like shown above and release 2020.3.3.
I am invoking with -e like php -e test.php

What could the problem be? Is there any more resources like debug logs I can use to troubleshoot this? It seems PhpStorm is not passing the breakpoints correctly to yasd but I don't know where to begin to correct it.

Seems like its not working for me. If I run php -e while yasd is enabled I get this problem: #99

If I run without -e still it is not working, probably because it must know IP address to send debug data to, but it cannot resolve my IP still inside of docker, while xdebug can but I get instant oom and have to kill all docker :D

As well why it is closed if its is not resolved to full extent. :-)

from yasd.

huanghantao avatar huanghantao commented on May 26, 2024

@superdav42 You can configure the following configuration:

yasd.log_level=0

You will get a file called debug.log in your current directory.

from yasd.

huanghantao avatar huanghantao commented on May 26, 2024

@superdav42 It is recommended that you first debug the test.php file under the yasd directory, and then debug your own project after success.

from yasd.

ollosh avatar ollosh commented on May 26, 2024

@gotys What is your server setup? I have [yasd] connection refused issues popping up when I try to run php -e test.php inside my docker container

@hq9000 Can you also share your path mapping? Are you running the debugging script from within the container or from the outside

from yasd.

domgraziano avatar domgraziano commented on May 26, 2024

@gotys What is your server setup? I have [yasd] connection refused issues popping up when I try to run php -e test.php inside my docker container

same here

from yasd.

deminy avatar deminy commented on May 26, 2024

How to debug a Swoole-based web server using yasd (Yet Another Swoole Debugger) in Phpstorm?

Please check here: https://github.com/swoole/docker-swoole/tree/master/examples/35-debug-with-yasd

from yasd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.