Comments (27)
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
from yasd.
okay.
The php-side setup
- I'm running my php app in docker, the complete Dockerfile: https://gist.github.com/hq9000/f2fbb8dcf6a2a3799615064f2f9c5b5e
- I run the container with "host" networking and volume mapping that preserves path to my php files:
/home/me -> /home/me
- 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":
I have a simple script where i have set breakpoints at each and every line:
Expectation
in the setup above, I was expecting to have the first breakpoint hit when clicking here:
however, it does not happen
if i click on the "bug" icon instead, it gets me this:
running a container from that image, i can confirm that it can reach the phpstorm's port:
from yasd.
also i tried to enable some log by setting yasd.log_level = 3, the setting was applied:
but i dont' see any yasd-related logs appearing. Maybe i just don't know where to look for them.
from yasd.
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.
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.
Your test environment is not initialized well, you can look at YASD's CI:
https://github.com/swoole/yasd/actions
from yasd.
so is it expected to work with phpstorm or not?
I'm also unable to get it stop on breakpoints.
from yasd.
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.
Btw, it's said it supports vscode. Any luck with that one?
from yasd.
Yasd supports vscode and phpstorm. Maybe you should show me how you configure yasd?
from yasd.
First, click the "Listen" button instead of "Run" button:
Second, execute your script with -e
option, for example:
php -e test.php
Then, it will trigger breakpoint:
from yasd.
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
from yasd.
@hq9000 Thank you!
from yasd.
Okay on my side setup is like that:
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.
@juslintek i use php 7.4.
and, as i run in in CLI, so can't really comment about cookies and stuff.
from yasd.
@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.
@juslintek Can you debug the test.php file in the yasd directory?
from yasd.
@huanghantao yes.
from yasd.
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.
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.
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.
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
likephp -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.
@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.
@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.
@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.
@gotys What is your server setup? I have
[yasd] connection refused
issues popping up when I try to runphp -e test.php
inside my docker container
same here
from yasd.
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)
- macos(M1X) + yasd + hyperf debug报错 HOT 5
- Undefined constant "request" HOT 3
- 请问下怎么解决单元测试覆盖率问题 HOT 5
- "php -e" debug with VsCode and Docker Alpine error "Segmentation fault" HOT 1
- Can not check the value of static variables in a class HOT 1
- M2 编译失败(M2 Compilation fails) HOT 9
- 能够进入,但是执行下一步,就会报这个错误。php代码没问题。 HOT 15
- Undefined constant "this" in yasd://debug-eval:1 HOT 5
- 大佬 这个报错啥原因呢 HOT 1
- It's not possible to compile in the php:8.1-cli-alpine3.17 HOT 1
- centos7 php7.2下编译失败
- output:Segmentation fault HOT 10
- There is an error in the compilation(make) HOT 3
- mark error ( errors generated. make: *** [src/remote_debugger.lo] Error 1 ) HOT 2
- make test 失败率90% ,php -e 报Segmentation fault 安装完后不能正常使用。 HOT 2
- centos7编译安装成功,配置文件也已加上扩展,但是php --ri yasd没有相关信息 HOT 1
- 我用sdebug时可以将hyperf断点停在vendor的Server.php中的sortServers函数里,但是使用yasd不行,是我哪里配置不对吗? HOT 2
- centos7系统下php8.2.4 make 报错 HOT 1
- 'zend_string *' (aka '_zend_string *') from 'char *' HOT 1
- 希望可以支持php7.1版本
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yasd.