简体   繁体   中英

Troubles with PhpStorm web server debug validation

In PhpStorm, I'm trying to debug code on remote server. Web server debug validation keeps telling me the specified url is not reachable (404).

My host is under windows

My server is on a VirtualBox VM (Debian 9)

I edit code with PhpStorm on a network drive V: pointing to my VM's /var/www/ folder. This is not a VirtualBox shared folder (not supported for Debian 9). So, when I work on V:\myproject , I'm actually working on /var/www/myproject on the VM through smb.

I followed a lot of tutorials, but never succeeded. Currently, I have the following configuration:

  • PHP Cli remote interpreter, using a deployment configuration
  • Said deployment configuration's connection type is SFTP (Connexion test is OK). Root path is /var/www/myproject . Webserver url is https://my.project.local (url was tested in my browser)
  • Mapping local path: V:\myproject
  • Mapping deployment path: /
  • Mapping web path: /pub (this project is a Magento 2 application. Pub is the web root)

When I try validating web server debug, I select "Remote Web Server", the path to create validation script is V:\myproject\pub , deployment server is the previously described deployment configuration.

Validation fails, saying "Specified URL is not reachable, caused by: 'Request failed with status code 404'".

Has anyone already been through this specific setup? (PhpStorm + remote debug on a VirtualBox VM + SFTP connection). Did you manage to make it work? Maybe I should try another way to make it work? Help will be highly appreciated !

A bit late, but for anyone else having this problem that happens to be running Magento 2 on Nginx, look in nginx.conf.sample , or whatever ngxin.conf you're using.

Find the below block:

# PHP entry point for main application
location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check)\.php$ {
    try_files $uri =404;
    fastcgi_pass   fastcgi_backend;
    fastcgi_buffers 1024 4k;

    fastcgi_param  PHP_FLAG  "session.auto_start=off \n suhosin.session.cryptua=off";
    fastcgi_param  PHP_VALUE "memory_limit=756M \n max_execution_time=18000";
    fastcgi_read_timeout 600s;
    fastcgi_connect_timeout 600s;

    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

Modify it as such, allowing Nginx to serve the validation script:

# PHP entry point for main application
location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check|_intellij_phpdebug_validator)\.php$ {
    try_files $uri =404;
    fastcgi_pass   fastcgi_backend;
    fastcgi_buffers 1024 4k;

    fastcgi_param  PHP_FLAG  "session.auto_start=off \n suhosin.session.cryptua=off";
    fastcgi_param  PHP_VALUE "memory_limit=756M \n max_execution_time=18000";
    fastcgi_read_timeout 600s;
    fastcgi_connect_timeout 600s;

    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM