简体   繁体   English

PhpStorm Web 服务器调试验证的问题

[英]Troubles with PhpStorm web server debug validation

In PhpStorm, I'm trying to debug code on remote server.在 PhpStorm 中,我正在尝试调试远程服务器上的代码。 Web server debug validation keeps telling me the specified url is not reachable (404). Web 服务器调试验证一直告诉我无法访问指定的 url (404)。

My host is under windows我的主机在windows下

My server is on a VirtualBox VM (Debian 9)我的服务器在 VirtualBox VM (Debian 9) 上

I edit code with PhpStorm on a network drive V: pointing to my VM's /var/www/ folder.我在网络驱动器V:指向我的 VM 的/var/www/文件夹上使用 PhpStorm 编辑代码。 This is not a VirtualBox shared folder (not supported for Debian 9).这不是 VirtualBox 共享文件夹(不支持 Debian 9)。 So, when I work on V:\myproject , I'm actually working on /var/www/myproject on the VM through smb.因此,当我处理V:\myproject时,我实际上是通过 smb 在 VM 上处理/var/www/myproject

I followed a lot of tutorials, but never succeeded.我遵循了很多教程,但从未成功。 Currently, I have the following configuration:目前,我有以下配置:

  • PHP Cli remote interpreter, using a deployment configuration PHP Cli 远程解释器,使用部署配置
  • Said deployment configuration's connection type is SFTP (Connexion test is OK).所述部署配置的连接类型为 SFTP(连接测试正常)。 Root path is /var/www/myproject .根路径是/var/www/myproject Webserver url is https://my.project.local (url was tested in my browser) Web 服务器 url 是https://my.project.local (url 在我的浏览器中测试过)
  • Mapping local path: V:\myproject映射本地路径: V:\myproject
  • Mapping deployment path: /映射部署路径: /
  • Mapping web path: /pub (this project is a Magento 2 application. Pub is the web root)映射网页路径: /pub (本项目为Magento 2应用,pub为网页根目录)

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.当我尝试验证 web 服务器调试时,我选择“远程 Web 服务器”,创建验证脚本的路径是V:\myproject\pub ,部署服务器是前面描述的部署配置。

Validation fails, saying "Specified URL is not reachable, caused by: 'Request failed with status code 404'".验证失败,显示“无法访问指定的 URL,原因是:‘请求失败,状态代码为 404’”。

Has anyone already been through this specific setup?有没有人已经通过这个特定的设置? (PhpStorm + remote debug on a VirtualBox VM + SFTP connection). (PhpStorm + VirtualBox VM + SFTP 连接上的远程调试)。 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.有点晚了,但对于碰巧在 Nginx 上运行 Magento 2 的其他人来说,请查看nginx.conf.sample或您正在使用的任何 ngxin.conf 。

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:像这样修改它,允许 Nginx 提供验证脚本:

# 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;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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