Closed juslintek closed 3 years ago
Okay fixed this. I guess nginx cannot proxy xdebug headers or something related to it. So I had to Nginx and expose port to swoole container itself and it worked. End results screenshot: app is /etc/hosts map to 127.0.0.1, which docker DNS resolves to the actual container.
So it seems that when runtime coroutines are enabled it doesn't work.
You should export the env PHP_IDE_CONFIG="serverName=your server name like myg2-app"
@amuluowin when I set this inside docker as the environmental variable PHP_IDE_CONFIG="serverName=myg2-app"
it is found there, but still it doesn't work xdebug log says:
[747] Log opened at 2020-07-17 10:30:20
[747] I: Connecting to configured address/port: host.docker.internal:9000.
[747] W: Creating socket for 'host.docker.internal:9000', poll success, but error: Operation now in progress (29).
[747] E: Could not connect to client. :-(
[747] Log closed at 2020-07-17 10:30:20
[752] Log opened at 2020-07-17 10:30:42
[752] I: Connecting to configured address/port: host.docker.internal:9000.
[752] W: Creating socket for 'host.docker.internal:9000', poll success, but error: Operation now in progress (29).
[752] E: Could not connect to client. :-(
[752] Log closed at 2020-07-17 10:30:42
If I switch back to php-fpm and xdebug it works even without the above variable.
And PhpStorm doesn't break on that point, just hangs response.
We recommend using https://github.com/swoole/yasd to debug
We recommend using https://github.com/swoole/yasd to debug
It doesn't work with phpstorm and vscode and probably with php8.
Please answer these questions before submitting your issue. Thanks!
host.docker.internal
which is at entrypoint.sh resolved if not exist in operating system to docker containers default gateway. Basically here are sdebug configs.xdebug.ini
What did you expect to see? I expect when the request is sent to URI, it breaks at the breakpoint of an action which is the underlying function for endpoint.
What did you see instead? I go no reaction at all. It just skips Sdebug at all. But when I run that remote debug configurations before swoole process start it never starts, even though that controller is not even triggered.
What version of Swoole are you using (show your
php --ri swoole
)?swoole
Swoole => enabled Author => Swoole Team team@swoole.com Version => 4.5.2 Built => Jun 23 2020 14:59:52 coroutine => enabled epoll => enabled eventfd => enabled signalfd => enabled cpu_affinity => enabled spinlock => enabled rwlock => enabled sockets => enabled openssl => OpenSSL 1.1.1f 31 Mar 2020 http2 => enabled pcre => enabled mutex_timedlock => enabled pthread_barrier => enabled futex => enabled mysqlnd => enabled async_redis => enabled
Directive => Local Value => Master Value swoole.enable_coroutine => On => On swoole.enable_library => On => On swoole.enable_preemptive_scheduler => Off => Off swoole.display_errors => On => On swoole.use_shortname => On => On swoole.unixsock_buffer_size => 8388608 => 8388608
I'm providing Dockefile itself:
start-container.sh
vessel.ini
supervisord.conf
just init new laravel project and install
laravel-s
runphp artisan laravels publish
then add these configs to config/ dir of new laravel project init: laravels.php
And in
routes/api.php
addrun
bin/laravels start
check it locally or run my Dockerfile with 5200 port exposed and use in configs port 5200 instead of 80 as I do. Because in my setup swoole is under Nginx proxy.