Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Guzzle and XDebug timeout

I am using Xdebug to debug code with guzzle curl calls.

In any other code, Xdebug works fine.

But whenever there are client calls with Guzzle, All I get is a timeout.

I am using:

  • PhpStorm 2017.2
  • Docker, with image richarvey/nginx-php-fpm:latest (nginx+php fpm)
  • Xdebug on Php 7.1

here is the code snippet, where it freezes:

    public function fetch(): string
{
    $content = '';
    $completePath = self::FETCH_PATH . $this->id;
    $request = $this->httClient->get($completePath);
    if ($request->getStatusCode() == 200) {
        $content = $request->getBody()->getContents();
    }
    return $content;
}
like image 584
Confidence Avatar asked Nov 19 '25 11:11

Confidence


1 Answers

I had the same problem. I believe that the problem occured when two different php process tried to open a Xdebug connection at the same time with the same IDE KEY. (like when you run a test with php cli and the test does a request to your apache/nginx/php-fpm). I assigned a different Xdebug IDE key for cli and fpm and it worked for me.

like image 180
Cedric Avatar answered Nov 21 '25 02:11

Cedric



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!