【发布时间】:2016-12-12 20:06:58
【问题描述】:
我已经安装了 PhpStorm 2016.2.1 (EAP),一切正常,但遗憾的是,调试对我不起作用。我已经尝试从here 进行零配置但没有成功:(
有用信息:
- 我有一个运行 CentOS 7 的 VM,我有 LAMP 环境。
-
/var/www/html/plataforma56.local是项目所在服务器上的路径 - 远程路径通过 SFTP 映射到我的主机(使用 SFTP 网络)
- PhpStorm 下的项目类型为:“源文件位于本地目录中,尚未配置 Web 服务器”。
- PHP版本为5.6.24
- Xdebug 版本为 2.4.1
- Xdebug 已启用(见下图)
-
我使用
phpinfo()和Xdebug wizard page 生成的HTML 检查了Xdebug,根据输出一切正常:Summary Xdebug installed: 2.4.1 Server API: Apache 2.0 Handler Windows: no Zend Server: no PHP Version: 5.6.24 Zend API nr: 220131226 PHP API nr: 20131226 Debug Build: no Thread Safe Build: no Configuration File Path: /etc Configuration File: /etc/php.ini Extensions directory: /usr/lib64/php/modules 我运行的是 Windows 10 x64
- 我的 AV 是 ESET Smart Security(是的,我已禁用防火墙只是为了查看这是否是根本原因,但没有成功)
- Xdebug 配置中的 IP/Port 没问题我已经检查了好几次(即使是在 Communication Setup 下的 here 也是一个非常有用的动画,它解释了发生的事情,因此我们可以正确理解)
- 没有使用端口
9005在 Windows 上运行的应用程序 - phpStorm 安装在 IP 的主机上:
192.168.3.1 - IDE 已配置
- 路径映射已配置
- SFTP 连接正常
- 使用 Xdebug Helper 扩展在浏览器中启用了 Xdebug(Chrome/Firefox 都运行最新版本)...
- 在 Cookie 中 ...
- 在会话存储中(由我手动设置以防万一)
- 在本地存储中(由我手动设置以防万一)
- 最后绿色的小图标说:扩展已启用
- 断点设置多次,我还添加了一个程序断点:
xdebug_break()
-
我还检查了端口是否在主机中打开并监听,结果如下:
================================================== Process Name : PhpStorm64.exe Process ID : 7496 Protocol : TCP Local Port : 9005 Local Port Name : Local Address : 0.0.0.0 Remote Port : Remote Port Name : Remote Address : 0.0.0.0 Remote Host Name : State : Listening Process Path : C:\Program Files (x86)\JetBrains\PhpStorm 2016.2.1\bin\PhpStorm64.exe Product Name : PhpStor File Description : PhpStor File Version : 2016.2.1.PS-162.1447. Company : JetBrains s.r.o. Process Created On: 8/6/2016 12:53:41 PM User Name : REYNIERDESKTOP\ReynierPM Process Services : Process Attributes: A Added On : 8/6/2016 1:54:39 PM Module Filename : Remote IP Country : ==================================================
最后,这是/etc/php.ini的配置块:
[Xdebug]
xdebug.remote_enable = true (I have play with true|1 here)
xdebug.remote_host = 192.168.3.1
xdebug.remote_port = 9005
xdebug.idekey = XDEBUG_PHPSTORM
xdebug.remote_handler = dbgp
xdebug.profiler_enable = 0
xdebug.remote_autostart = 1
xdebug.remote_log = "/tmp/xdebug.log"
拥有所有这些信息,我应该问:
- 我在这里遗漏了什么?
- 为什么这不起作用?
- 既然这是一个 CodeIgniter 3 项目,是否可以调试这个应用程序? (虚拟问题,但可能由于某种原因不可能)
我在这里唯一缺少的是 Xdebug 日志,但我在服务器上的 /tmp/xdebug.log 下没有看到任何文件(你告诉我,我的配置可能没有正确设置)
我对任何解决方案持开放态度,因为此时我已经没有什么想法了,并且花了几个小时试图让这个工作正常(当您遇到需要修复的应用程序问题时最好)
注意:我知道这是一个常见且反复出现的问题,并且已被多次询问,但在关闭它之前,或者标记为重复或否决票,请尝试提供帮助。
我应该在这里补充一下,我已经阅读了这个帖子列表:
- Xdebug not working with PHPStorm
- How to setup PHPStorm debugger
- PHPStorm + XDebug Setup Walkthrough
- https://confluence.jetbrains.com/display/PhpStorm/Zero-configuration+Web+Application+Debugging+with+Xdebug+and+PhpStorm
- https://blog.jetbrains.com/webide/2011/03/configure-php-debugging-in-phpstorm-2-0/
- xdebug running in PHPStorm unable to connect to remote server
- Debug Symfony2 with XDebug and PHPStorm
- XDebug with Symfony and PhpStorm doesn't work (Ubuntu installation)
而且我可以继续添加越来越多,因为我花了几个小时试图找出为什么不起作用。
编辑:运行/调试配置屏幕
【问题讨论】:
-
您需要提供xdebug日志。没有办法(至少对我而言)没有这样的日志就无法判断 xdebug 是否正在那里收听。日志应该告诉它尝试连接的 IP/端口以及它想要调试的文件。您也可以尝试较旧的 xdebug 版本(2.4.0 甚至 2.3.x)——也许这个 xdebug 构建等有问题。
-
@LazyOne 你能帮我获取这样的日志吗?我在任何地方都没有看到它们,这就是我在这里所说的“我在这里唯一缺少的是 Xdebug 日志,但我在服务器上的 /tmp/xdebug.log 下没有看到任何文件(可能在我的配置中没有正确设置,你告诉我)”
-
访问权限受限?尝试确定 Apache/PHP 可以写入的不同文件夹。尝试使用
remote_autostart = 1,以便 xdebug 尝试编辑每个脚本。我不知道为什么 xdebug 在它仍然可以调试时无法写入日志。我在这里只看到一个问题,有人说:“好的,它现在可以工作了.. 但仍然没有日志”.. 但在我记得的所有其他情况下,日志都是生成的...... -
@LazyOne 不起作用,我已经更改了 Apache 写入日志的路径,并且没有创建
/var/log/httpd/xdebug.log文件,我还添加了您告诉我的行 -
不是 Linux 人——不知道它可能是什么(为什么不生成日志)。在这种情况下我唯一的建议——尝试不同的 xdebug 版本/构建。
标签: php codeigniter debugging phpstorm xdebug