Caddy and Xdebug - Connect back

I’m trying to get Xdebug to connect back to PhpStorm. Xdebug connects with PhpStorm properly with built-in Php web server but not with Caddy.

Here’s my Caddyfile:

root www
errors visible
gzip
browse
tls off
fastcgi / 127.0.0.1:9001 php

Starting php-cgi.exe with

php-cgi.exe -b 127.0.0.1:9001

Xdebug configuration in php.ini:

zend_extension=php_xdebug.dll
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_connect_back=1
xdebug.remote_port=9000
xdebug.cli_color=1

Any ideas?

System:
Windows 10 64-bit
Php 7.0.10 with Xdebug 2.4.1
Caddy 0.9.1

Thanks!

Firstly, ensure that is the correct php.ini, you can verify that from the phpinfo page.

What is the port configuration on PhpStorm ?

The php.ini path is correct as displayed by phpinfo(). The port in PhpStorm is 9000.

The first line of your Caddyfile must be the address of the site you’re serving. Did you intend to serve it on addresses root and www?

1 Like

Apologize. Yes, I missed copying the outer lines. My full Caddyfile is:

localhost:8080 {
    root www
    errors visible
    gzip
    browse
    tls off
    fastcgi / 127.0.0.1:9001 php
}

Here’s my test PHP index.php file:

<?php
$var = 'Hello World';
echo $var;
var_dump($_COOKIE);

The breakpoint is set on the second line $var = 'Hello World';. The dump shows that XDEBUG_SESSION has been properly set by PhpStorm bookmarklet in Chrome:

Hello World
Z:\Server\CaddyTest\www\index.php:4:
array (size=1)
  'XDEBUG_SESSION' => string 'PHPSTORM' (length=8)

Still not able to get Xdebug to connect back to PhpStorm with Caddy 0.9.3. Anybody have any luck?

I’m having the same problem, fwiw.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.