问题描述
我想将 Xdebug 专门用于 PHPStorm 的单步调试功能。我在我的个人应用程序上使用 Xdebug 就好了,没有端口转发。但是,我当前的问题是服务器上的应用程序我没有管理员权限来处理 PHP.ini 文件和 20-xdebug.ini。我想通过配置 .htaccess 来使用 Xdebug,我“确实”在 /public 目录中拥有写入权限。我相信我的问题是因为我们中间有一个名为 Jump Server 的服务器,我认为我的配置不正确。
X-debug 已安装在 Web 服务器上,但目前已禁用。我在 /public 文件夹中使用 .htaccess 启用它。由于许多开发人员共享服务器,因此 IT 不会在系统上启用它。我是唯一一个在我正在开发的应用中使用 Xdebug 的人。
已安装 Xdebug。
<pre>
developer@****:~$ PHP --version
PHP 7.2.24-0ubuntu0.18.04.6 (cli) (built: May 26 2020 13:09:11) ( NTS )
copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0,copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.24-0ubuntu0.18.04.6,copyright (c) 1999-2018,by Zend Technologies
with Xdebug v2.6.0,copyright (c) 2002-2018,by Derick Rethans
</pre>
<pre>
developer@****:~$ PHP --ini
Configuration File (PHP.ini) Path: /etc/PHP/7.2/cli
Loaded Configuration File: /etc/PHP/7.2/cli/PHP.ini
Scan for additional .ini files in: /etc/PHP/7.2/cli/conf.d
Additional .ini files parsed: /etc/PHP/7.2/cli/conf.d/10-MysqLnd.ini,...
/etc/PHP/7.2/cli/conf.d/20-xdebug.ini,...
</pre>
.htaccess 配置:
<pre>
developer@****:~$ cat /www/1234-5678/public/.htaccess
zend_extension=xdebug.so
PHP_flag xdebug.remote_enable=1
PHP_flag xdebug.remote_autostart on
PHP_flag xdebug.remote_connect_back=1
PHP_flag xdebug.remote_port=9000
PHP_flag xdebug.max_nesting_level=512
PHP_flag xdebug.remote_host="192.168.10.1"
PHP_flag xdebug.idekey=PHPSTORM
</pre>
已安装的 Xdebug 配置:
<pre>
developer@****:~$ cat /etc/PHP/7.2/cli/conf.d/20-xdebug.ini
zend_extension=xdebug.so
</pre>
有了那套...
这是我连接到网络服务器的方式: PC > PuTTy SSH 连接到 Jump Server > Jump Server 通过端口 # 和 localhost (ssh -p #### localhost) SSH 到服务器
我已经配置了 PuTTY:
<pre>
Session -
Host Name (or IP address) - fake.jumpserver.com
Port: 22
Connection > SSH > Tunnels
Source Port: 7008
Destination: 192.168.240.100:22008
</pre>
打开 PuTTy 连接后,我可以使用命令 ssh 进入本地端口 7008(远程端口 192.168.240.100:22008)。
<pre>
developer@lenovo MINGW64 ~
$ ssh -p 7008 localhost
Welcome to Ubuntu 18.04.4 LTS (GNU/Linux 5.3.0-1017-aws x86_64)
...
Last login: Fri Jan 15 18:09:05 2021 from 192.168.240.100
developer@****:~$ cd /www/app/1234-5678/public
developer@****:/www/app/1234-5678$ pwd
/www/app/1234-5678/public
</pre>
PHPStorm 配置:
SSH 配置,测试连接成功!
<pre>
Name: Port_22008_SSH
Host: localhost
Port: 7008
Username: developer
Local port: --dynamic
Authentication type: Key pair OpenSSh or PuTTY
Private key file: C:\...\developer\.ssh\id_rsa
Passphrase: *****
</pre>
构建、执行、部署:
<pre>
Connection -
Name: Port_22008_SFTP
Type: SFTP
SSH Configuration: Port_22008_SSH
Test Connection: Success
Root path: /www/app/1234-56789
Web server URL: https://1234-56789.fakewebsitelink.com
Mappings -
Local path: C:\Users\developer\PHPstormProjects\contracts\1234-5678
Deployment path: /
Web path: /
</pre>
语言和框架
<pre>
PHP Language Level: 7.2
CLI Interpreter: Port_22008_CLI(7.2.24-0ubuntu0.18.04.6)
<pre>
Name: Port_22008_CLI
SSH Configuration: Port_22008_SSH
PHP Executable: /usr/bin/PHP
</pre>
Path mappings: Project-root->/www/app/1234-5678
</pre>
现在开始验证调试器配置 语言和框架 > 调试
<pre>
Path to create validation script: C:\Users\developer\PHPstormProjects\contracts\1234-5678
Deployment Server: Port_22008_SFTP
</pre>
在浏览器中启用调试器
创意日志文件:
INFO - eyprovider.OpenSSHkeyv1KeyFile - Keypair is encrypted with: aes256-ctr,bcrypt,[0,16,59,-84,-66,-121,47,63,91,-99,-127,88,-125,-126,-39,70,-9,16] WARN - net.schmizz.concurrent.Promise - > woke to: opening `session` channel Failed: open Failed INFO - .channel.direct.SessionChannel - Will request `sftp` subsystem INFO - eyprovider.OpenSSHkeyv1KeyFile - Keypair is encrypted with: aes256-ctr,16] INFO - on.PHPRemoteWebServerValidator - Create file '/www/app/1234-5678/_intellij_PHPdebug_validator.PHP' INFO - on.PHPRemoteWebServerValidator - Uploading validation script to Port_22008_SFTP completed in 1 sec,45 ms: 1 file transferred (5.8 kbit/s) WARN - lidation.PHPWebServerValidator - Web server validation Failed due to: 'Request Failed with status code 404' INFO - eyprovider.OpenSSHkeyv1KeyFile - Keypair is encrypted with: aes256-ctr,16] INFO - on.PHPRemoteWebServerValidator - Delete file '/www/app/1234-5678/_intellij_PHPdebug_validator.PHP' WARN - .AbstractProgressIndicatorBase - This progress indicator is indeterminate,this may lead to visual inconsistency. Please call setIndeterminate(false) before you start progress. com.intellij.ide.util.DelegatingProgressIndicator.setFraction(DelegatingProgressIndicator.java:78) INFO - on.PHPRemoteWebServerValidator - Cleaning up... completed in 138 ms: 1 item deleted
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)