我使用 PHPStorm 和 Xdebug 来单步调试我的代码。 PHPStorm 在 Windows 7 计算机上运行,而我的本地网络服务器在单独的 CentOS 6.4 计算机上运行。我已经完成了
phpinfo();
来验证 Xdebug 是否正在由 PHP 加载,确实如此。以下是我的 Xdebug 在 PHP.ini 中的设置:
[x调试] zend_extension =“/usr/lib/php/modules/xdebug.so” xdebug.remote_enable = 1 xdebug.remote_port = 9000 xdebug.remote_host = "192.168.1.130" xdebug.remote_log = "/var/log/httpd/xdebug_log"我同样设置 PHPStorm 以使用我的 CentOS 服务器作为调试服务器,并监听连接。我为这两台机器分配了静态IP。使用 Chrome Xdebug 插件设置适当的 cookie,我尝试设置断点,但没有任何反应。当我查看 /var/log/httpd/xdebug_log (具有 777 权限)时,那里没有写入任何内容。我已经打开了端口 9000,并且我可以从我的 CentOS 计算机通过端口 9000 远程登录回我的 Windows 计算机,没有问题。我也将SELinux设置为permissive,但没有效果。
你知道这里会发生什么吗?
尝试在 PhpStorm 中配置您的项目
添加到您的 php.ini:
xdebug.mode=debug
我遇到了同样的问题,以下是我为解决该问题而执行的步骤:
xdebug.mode=debug
完成此设置后,您可以设置断点并使用 XDEBUG 开始调试。
就我而言,我添加了正在调试的文件夹,因此当我设置断点时它会返回 502 或空白页。删除专用文件夹和一切正常。
您可以考虑此博客来寻找更多解决方案:链接。
sudo gedit /etc/php/7.2/mods-available/xdebug.ini
zend_extension=xdebug.so
xdebug.remote_enable = 1
xdebug.remote_port = 9898
xdebug.idekey = “PHPSTORM”
xdebug.show_error_trace = 1
xdebug.remote_autostart = 0
xdebug.mode=debug
xdebug.client_port=9898