I am trying to setup Xdebug with PhpStorm. When I try and validate my script, I get the following error:
Specified URL is not reachable, caused by: ‘Request failed with status code 400’
The error used to display a 404 status code, but I applied the fix on this page: https://www.jetbrains.com/help/phpstorm/validating-the-configuration-of-the-debugging-engine.html#troubleshooting-validation-results
I haven’t seen anything online for fixing a 400 status code.
I have the site setup on a local environment using nginx and an upstream using php-fpm.sock.
upstream site_backend {
server unix:/var/run/php/php7.4-fpm.sock;
}
And here is my xdebug.ini:
GNU nano 4.8 /etc/php/7.4/fpm/conf.d/20-xdebug.ini
zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.var_display_max_depth = -1
xdebug.var_display_max_children = -1
xdebug.var_display_max_data = -1
xdebug.idekey = "PHPSTORM"
The site works, only Xdebug isn’t working. PhpStorm is not registering anything from Xdebug.
Not sure what else is needed, let me know if you need anything else.
UPDATE:
Xdebug is version 3.0.4.
In the nginx error log, I saw something that might be helpful:
2021/04/19 10:26:08 [error] 736434#736434: *72 access forbidden by rule, client: 127.0.0.1, server: mysite.localhost, request: "GET /_intellij_phpdebug_validator.php HTTP/1.1", host: "mysite.localhost"
UPDATE 2:
I made the changes at https://xdebug.org/docs/upgrade_guide, still isn’t working. Here is the update xdebug.ini:
zend_extension=xdebug.so
xdebug.mode=debug
xdebug.session=PHPSTORM
xdebug.start_with_request=yes
Not sure if it’s correct configuration. I also double checked to make sure PHPStorm is listening on port 9003, which it is. I also restarted php-fpm as well.
3
Answers
I got the same issue and I was able to resolve this buy just replacing the default URL assigned (http://127.0.0.1) with my virtual host URL in PHPStorm > Run > Web Server Debug Validation > URL to validation script.
OS: Ubuntu 20.04.3 LTS
PHP version: 7.4.3
XDebug version: 2.9.2
/etc/php/7.4/mods-available/xdebug.ini:
I got the same problem and I resolved this buy just
changing the value in the php.ini file of the xdebug.start_upon_error from the default "default" to "yes" due too https://www.jetbrains.com/help/phpstorm/configuring-xdebug.html#configuring-xdebug-docker
I got the same issue by using ddev ( = a docker wrapper).
The absolute path to my project is
/var/www/html
in ddev.I had to write
/var/www/html
as the absolute path to my project in the phpstorm settings atphp>servers
.