xdebug 不会在断点处停止

发布于 2024-09-29 06:13:40 字数 656 浏览 9 评论 0原文

我花了几个小时来设置我的 IDE,用 eclipse 和 xdebug 调试 PHP。除了我在 eclipse 上设置的断点之外,一切都很好。如果我双击一行添加断点,调试器希望停止。如果添加行 xdebug_break() 调试器会在该行停止...

这可能是一个问题与配置。有人可以帮助我吗?

  • Eclipse:Eclipse PDT 2.2.0 全部包含 Windows 32 位
  • Xdebug: 5.3 VC6 (32 位)
  • PHP:PHP 版本 5.3.3

PHP.ini

[xdebug]
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.remote_mode=req
xdebug.profiler_enable = 1
xdebug.profiler_output_dir = "c:/temp"
xdebug.collect_params = 4
xdebug.collect_return = on
xdebug.collect_vars = on

xdebug.show_local_vars = 1

I spend some hours to set up my IDE to debug PHP with eclipse and xdebug.. Everything is ok except the breakpoint I set on eclipse. If I double-click on a line to add a breakpoint, the debugger want not to stop.. If a add the line xdebug_break() the debugger stops well at the line...

It's maybe a problem with the configuration. Could anyone help me ?

  • Eclipse: Eclipse PDT 2.2.0 All In
    Ones Windows 32 bits
  • Xdebug: 5.3 VC6
    (32 bit)
  • PHP: PHP Version 5.3.3

PHP.ini

[xdebug]
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.remote_mode=req
xdebug.profiler_enable = 1
xdebug.profiler_output_dir = "c:/temp"
xdebug.collect_params = 4
xdebug.collect_return = on
xdebug.collect_vars = on

xdebug.show_local_vars = 1

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(20

白日梦 2024-10-06 06:13:41

我也有同样的问题。解决方案是打开正确的文件并在其中添加断点。

我的本地服务器位于我的虚拟 Z: 驱动器上(我使用 denwer 而不是 WAMP)。 Z 驱动器指向我的 D:/webserver 文件夹。因此,我可以将文件打开为 1) Z:/myproject/script.php 和 2) D:/webserver/myproject/script.php

由于某些原因,调试器停止仅在打开的 Z:/myproject/script.php 文件中设置断点。

如何测试我的解决方案???接下来执行以下操作:

  1. 打开要调试的任何 php 文件
  2. xdebug_break() 添加到任意行并保存文件
  3. 运行调试

在我的情况下,在调试过程启动我的 phpDesigner IDE 后,在 IDE 中打开正确的文件并在 xdebug_break 处停止() 线。因此,在这个新打开的文件中,您可以添加断点,它们将起作用。使用打开的文件进行调试。

I had the same problem. The solution is to open correct file and add breakpoint in it.

My local server is on my virtual Z: drive (I'm using denwer instead of WAMP). Z drive points to my D:/webserver folder. So I can open my file as 1) Z:/myproject/script.php and as 2) D:/webserver/myproject/script.php

For some reasons debugger stops on breakpoints only in openned Z:/myproject/script.php file.

How to test my solution??? Do next:

  1. Open any php file you want to debug
  2. Add xdebug_break() to any line and save file
  3. Run debug

In my case after debug process has started my phpDesigner IDE open correct file in IDE and stops at xdebug_break() line. So in this new opened file you can add breakpoints and they will work. Use opened file for debug.

扬花落满肩 2024-10-06 06:13:41

当我从 Xdebug 2 迁移到 3 时,这里出现了类似的问题。

有一个 文档 来解决这个问题,但最重要的一点是:

Xdebug 的默认调试端口已从 9000 更改为 9003

要确保仅“单步调试”处于活动状态,而不是:

xdebug.remote_enable=1
xdebug.default_enable=0
xdebug.profiler_enable=0
xdebug.auto_trace=0
xdebug.coverage_enable=0

您现在只需:

xdebug.mode=debug

xdebug.remote_autostart 设置已被删除。相反,设置

xdebug.start_with_request=yes

Similar problem here when I migrated from Xdebug 2 to 3.

There is a documentation for that but the most important points are:

Xdebug's default debugging port has changed from 9000 to 9003.

To make sure that just Step Debugging is active, instead of:

xdebug.remote_enable=1
xdebug.default_enable=0
xdebug.profiler_enable=0
xdebug.auto_trace=0
xdebug.coverage_enable=0

You now only do:

xdebug.mode=debug

The xdebug.remote_autostart setting has been removed. Instead, set

xdebug.start_with_request=yes
梦旅人picnic 2024-10-06 06:13:41

我遇到了同样的问题,PDT 会启动调试会话,甚至会中断脚本的第一行并允许从那里单步执行,但如果我单击“恢复”,它会很高兴地运行我设置的任何手动断点。在摆弄它并阅读了一堆其他回复后,我修复了它。

我一直在尝试设置路径映射(在 PHP 服务器配置中),因为我的项目路径和 Web 服务器路径不同,但由于某种原因这不起作用,所以我最终在 apache 配置中添加了一个别名以匹配位置PDT 正在要求。但是,我并没有删除这个路径映射设置。当我删除路径图时,断点开始起作用!

可能是其他东西无法正常工作的症状(路径映射设置),但断点和调试现在都对我有用:)

I was having the same problem, PDT would start up the debug session, even breaking on the first line of the script and allowing stepping from there, but it would happily run through any manual breakpoints I had set if I clicked on Resume. After fiddling around with it and reading a bunch of other replies, I fixed it.

I had been trying to setup a Path Map (in the PHP server configuration) as my project path and web server paths were different, but this was not working for some reason so I ended up adding an alias to the apache config to match the location PDT was asking for. However, I had not removed this path map setting. When I removed the path map, breakpoints started to work!

Probably a symptom of something else not working properly ( the path map setting ) but breakpoints and debugging are all working for me now :)

倦话 2024-10-06 06:13:41

在移动一些本地项目文件夹后,我出现了这个问题。我可以让 xdebugger 在文件开头处中断,但它会跳过其余的断点。

如果您使用的是 Netbeans,请检查您的项目 Url(项目属性 -> 运行配置)是否指向正确的位置。当项目 URL 指向正确的文件夹时,断点开始按预期工作。

This problem popped for me after moving some of my local project folders around. I could get xdebugger to break at the beginning of the file, but it would skip the rest of my breakpoints.

If you are using Netbeans, check that your Project Url ( Project Properties->Run Configuration ) points to the correct location. With the Project URL pointed to the right folder, breakpoints starting working as expected.

暖风昔人 2024-10-06 06:13:41

只是提一下我的简单解决方案,当我新安装和配置的 xdebug 无法与 PhpStorm 一起使用时:我只是忘记在更新 php.ini 文件后重新启动 apache。

Just to mention the simple solution for me, when my freshly installed and configured xdebug didn't work with PhpStorm: I simply forgot to restart apache after updating the php.ini file.

极致的悲 2024-10-06 06:13:41

我连续几天都遇到同样的问题(!),因为我意识到这个问题是最微不足道的。

配置:

  • (Windows 7 主机)
  • VirtualBox 机器上的 Ubuntu 12.04
  • LAMP 手动安装
  • Eclipse Indigo + PDT
  • php5-xdebug

/etc/php5/apache2/php.ini

[XDebug]
zend_extension="/usr/lib/php5/20090626+lfs/xdebug.so"
xdebug.remote_enable=true
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.profiler_output_dir=/tmp

调试器执行了'不会在断点处停止,也不在 xdebug_break(); 处停止

...这是由于默认 Apache DocumentRoot 文件夹的 /var/www 权限

I将其更改为 /home/user/Documents/www

I had the same problem for days (!) since I realized that the problem was the most trivial one.

Configuration:

  • (Windows 7 Host)
  • Ubuntu 12.04 on VirtualBox Machine
  • LAMP installed manually
  • Eclipse Indigo + PDT
  • php5-xdebug

/etc/php5/apache2/php.ini

[XDebug]
zend_extension="/usr/lib/php5/20090626+lfs/xdebug.so"
xdebug.remote_enable=true
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.profiler_output_dir=/tmp

The Debugger did't stop at breakpoints and neither at xdebug_break();

...it was due to the default Apache DocumentRoot folder's /var/www permissions

I changed it to /home/user/Documents/www.

远昼 2024-10-06 06:13:41

快速回答:删除 php 脚本路径上的所有空格。

上下文:
PDT 插件版本 3.7.0 存在一个错误,该错误会阻止调试器在断点处停止。
当脚本的路径包含空格时就会发生这种情况!
它已被修复,但我猜目标版本 4.0.0 尚未发布。
拯救我一天的评论位于 https://bugs.eclipse.org/bugs/show_bug.cgi?id=489646#c7(“评论 7”)。

Quick answer: remove all white spaces on the path to your php script.

Context:
There is a bug on PDT plug-in version 3.7.0 which prevents the debugger from stopping at breakpoints.
And it happens when the path to your script contains a white space!
It has been fixed but I guess the target version, which is 4.0.0, has not been released yet.
The comment which saved my day is at https://bugs.eclipse.org/bugs/show_bug.cgi?id=489646#c7 ("Comment 7").

睫毛溺水了 2024-10-06 06:13:41

如果您使用的是 Eclipse,为特定启动配置的调试器(请参阅“调试器”选项卡)可能是 Zend 调试器,而不是 XDebug。修复您的调试启动并重试。这为我解决了问题。

不幸的是我无法发布屏幕截图。但是,在 Eclipse 中,您可以访问:
调试配置> PHP Web 应用程序 >然后选择您的启动>调试器选项卡>使用服务器调试器下拉列表选择 XDebug >点击“应用”按钮并重试。

If you are using Eclipse, it may be that the debugger configured for a specific launch (see Debugger tab) is the Zend Debugger, and NOT XDebug. Fix your debug launch and try again. That solved the problem for me.

Unfortunately I cannot post the screenshot. However, in Eclipse, you can go to:
Debug Configurations > PHP Web Application > then select your launch > Debugger Tab > use the Server Debugger drop down to select XDebug > hit the Apply button and retry.

夕嗳→ 2024-10-06 06:13:41

我遇到了同样的问题,并且两件事之一修复了它...

我在 PHP.ini 中删除了重复的 zend_extension 定义

,或者更有可能我只是从这里升级到最新的 xdebug 版本:
http://xdebug.org/download.php

(我正在运行 XAMPP v1.7.1 附带的 xdebug )

这又开始了...尝试了所有不同版本的 xdebug dll 等...结果发现导致此功能不起作用的原因是打开了“表达式”窗口...所以当您调试东西时请将其关闭...您可以临时添加一个监视,然后在“步骤”之前关闭表达式窗口...

假的...

I had the same problem and either one of two things fixed it...

I removed a duplicate zend_extension definition in my PHP.ini

or more likely I just upgraded to the latest xdebug version from here:
http://xdebug.org/download.php

(I was running xdebug that came with XAMPP v1.7.1)

THIS STARTED AGAIN... tried all different versions of xdebug dlls, etc... turned out that what was causing this to not work was having the Expressions window open... so keep it closed when you debug stuff... you can add a watch temporarily and then close the Expressions window before you "step"...

bogus...

深海不蓝 2024-10-06 06:13:41

1-检查 php.ini 上的 xdebug 配置

2- eclipse->项目->属性->phpDebug->
启用项目特定设置

phpDebugger->configuration->port
或者
widndow->首选项->php->调试->installedDebuggers

3-widndow->首选项->php->

解释器->版本
可执行文件-> php-win.exe 的路径

要点:对于每个调试库(xdebug,zend_debugger,...),您可以有一个默认的 php 可执行文件。

4-您的应用程序服务器在不同的端口上工作 80 。
窗口->首选项->php->
PHP服务器

1- check xdebug config on php.ini

2- eclipse->project->properties->phpDebug->
Enable project specific setting

phpDebugger->configurattion->port
or
widndow->preference->php->debug->installedDebuggers

3-widndow->preference->php->

Interpreter->version
executables-> path to php-win.exe

point : for each debug lib (xdebug,zend_debugger,...) you can have a default php executable.

4-your application server work on different port with 80 .
widndow->preference->php->
PHP servers

转瞬即逝 2024-10-06 06:13:41

我在 fedora release 20 Heisenbug、php-ZendFramework2-Debug-2.3.9-1.fc20.noarch、php-pecl-xdebug-2.2.7-1.fc20.i686 和 eclipse 版本:Mars.1 上添加了同样的问题发布 (4.5.1)。我使用了之前的答案,发现 eclipse 使用 ipv6,我按照 eclipse.ini 中的描述更改了 -Djava.net.preferIPv4Stack=true。 xdebug.ini 也是如此,但仍然无法工作,直到我发现我有 2 个 xdebug.ini 文件,一个位于 /etc/php-zts.d/ 中,这是错误的,另一个位于/etc/php.d/ 这是 apache 使用的。我将其修改为包含以下设置,

; Enable xdebug extension module
zend_extension=xdebug.so

xdebug.remote_enable=on
xdebug.remote_host="127.0.0.1"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.remote_mode=req
xdebug.remote_autostart=1
xdebug.idekey=

重新启动了网络sudo service network restart,现在检测到断点,我可以按预期进行调试。

I add the same problem on fedora release 20 Heisenbug, php-ZendFramework2-Debug-2.3.9-1.fc20.noarch, php-pecl-xdebug-2.2.7-1.fc20.i686, and eclipse Version: Mars.1 Release (4.5.1). I used the previous answers, discovered that eclipse use ipv6, I changed as described within eclipse.ini for -Djava.net.preferIPv4Stack=true. Same for xdebug.ini, and still not working, until I discovered that I had 2 xdebug.ini files, one in /etc/php-zts.d/ which is the wrong one, and one in /etc/php.d/ which is the one used by apache. I modified it to include the following setting

; Enable xdebug extension module
zend_extension=xdebug.so

xdebug.remote_enable=on
xdebug.remote_host="127.0.0.1"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.remote_mode=req
xdebug.remote_autostart=1
xdebug.idekey=

restarted the network sudo service network restart and now breakpoints are detected and I may debug as expected.

尘曦 2024-10-06 06:13:41

我也解决了这个问题。
使用 zend_extension 而不是扩展。

zend_extension_ts="C:\xampp\php\ext\php_xdebug.dll"

I have fixed this too.
Using zend_extension instead of extension.

zend_extension_ts="C:\xampp\php\ext\php_xdebug.dll"
瑾兮 2024-10-06 06:13:41

我在 Windows 上,Eclipse Oxygen。在花费了大量时间后,我发现简单删除和重新创建调试配置会有所帮助。

I'm on windows, eclipse Oxygen. After spending fair amount of time, I discovered that simple delete and recreation of Debug Configuration helped.

救赎№ 2024-10-06 06:13:41

我使用 eclipse-php-oxygen 遇到了同样的问题
问题在于日食。
我已经安装了 eclipse-php-luna-SR2-win32 并测试了 xdebug,它工作正常。

安装:
xampp-win32-7.0.30-0-VC14-installer.exe
Java 8 Update 171

以下是我在 php.ini 上的设置:

[XDebug]
zend_extension = C:\xampp\php\ext\php_xdebug-2.6.0-7.0-vc14.dll
;zend_extension = C:\xampp\php\ext\php_xdebug-2.5.5-7.0-vc14.dll
;zend_extension = "c:\xampp\php\ext\php_xdebug-2.6.0-7.2-vc15.dll"
xdebug.remote_autostart = 1
xdebug.profiler_append = 0
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "c:\xampp\tmp"
;xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.remote_log = "c:\xampp\tmp\xdebug.txt"
xdebug.remote_port = 9000
xdebug.trace_output_dir = "c:\xampp\tmp"
;36000 = 10h
xdebug.remote_cookie_expire_time = 36000

我希望这会有所帮助。

兄弟,
阿里

I had the same issue using eclipse-php-oxygen
The issue lies on eclipse.
I have installed eclipse-php-luna-SR2-win32 and tested xdebug and it works fine.

Installed:
xampp-win32-7.0.30-0-VC14-installer.exe
Java 8 Update 171

The following are my settings on php.ini:

[XDebug]
zend_extension = C:\xampp\php\ext\php_xdebug-2.6.0-7.0-vc14.dll
;zend_extension = C:\xampp\php\ext\php_xdebug-2.5.5-7.0-vc14.dll
;zend_extension = "c:\xampp\php\ext\php_xdebug-2.6.0-7.2-vc15.dll"
xdebug.remote_autostart = 1
xdebug.profiler_append = 0
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "c:\xampp\tmp"
;xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.remote_log = "c:\xampp\tmp\xdebug.txt"
xdebug.remote_port = 9000
xdebug.trace_output_dir = "c:\xampp\tmp"
;36000 = 10h
xdebug.remote_cookie_expire_time = 36000

I hope this will help.

Br,
Ali

总攻大人 2024-10-06 06:13:41

对我来说,问题似乎是 php 7.2 with Xdebug v2.7.0beta2-dev,请注意 beta 部分。这是使用 puphpet.com 安装的。我尝试了 php 7.1,问题消失了。我花了几个小时才找到这个!

For me the problem seemed to php 7.2 with Xdebug v2.7.0beta2-dev, notice the beta part. This was installed using puphpet.com. I tried php 7.1 and the problem vanished. Took me hours to find this!

爱已欠费 2024-10-06 06:13:41

这个问题困扰了我大约3个小时,终于解决了。所以,在你用枪指着你的头之前,先试试这个。 当 Eclipse 启动时,选择一个新工作区,然后再次设置您的项目!

在我这样做之后,我的断点再次被击中!
我的断点工作正常,然后突然停止工作。
我尝试过:

  1. 删除所有断点

  2. 清理项目

  3. 重新安装eclipse

以上都不适合我!

顺便说一句,我正在使用 Windows 7。

我希望这些信息可以拯救某人的生命!

顺便说一句:以下是使用 xdebug 和 vmwere 设置 Centos 7 以及带有 eclipse 的 Windows 7 客户端所采取的步骤:

下载 vmwere

downlaod 并使用以下命令设置 vmwere: CentOS-7-x86_64-Everything-1511.iso

禁用防火墙

systemctl 禁用防火墙

systemctl stop firewalld

systemctl status firewalld

通过 ftp ifconfig 连接

以查找 Ip

ifconfig

eno16777736: flags=4163 mtu 1500

inet 192.168.170.128 网络掩码 255.255.255.0 广播 192.168.170.255

inet6 fe80::20c:29ff:fec4:b 8ca prefixlen 64scopeid 0x20

以太00:0c:29:c4:b8:ca txqueuelen 1000(以太网)

RX 数据包 254 字节 20919 (20.4 KiB)

RX 错误 0 丢弃 0 溢出 0 帧 0

TX 数据包 95 字节 10225 (9.9 KiB)

TX 错误 0 丢弃 0 溢出 0运营商 0 冲突 0

192.168.170.128 是 ip

设置 LAMP

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*

yum -y install epel-release

yum -y install mariadb-server mariadb

systemctl start mariadb。服务

systemctl 启用 mariadb.service

mysql_secure_installation

yum -y 安装 httpd

systemctl 启动 httpd.service

systemctl 启用 httpd.service

yum -y 安装 php

服务 httpd 重新启动

yum -y 安装 php-mysql

yum -y 安装 php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring

php-snmp php-soapcurlcurl-devel

服务 httpd 重新启动

yum 在 Windows 上安装 phpMyAdmin

打开 cmd,键入 ipconfig

找到

以太网适配器 VMware 网络适配器 VMnet8:

Connection-specific DNS Suffix  . : localdomain

Link-local IPv6 Address . . . . . : fe80::94b8:9e5c:c772:3d47%19

IPv4 Address. . . . . . . . . . . : 192.168.170.1 [ this is the widnows ip to allow ]

Subnet Mask . . . . . . . . . . . : 255.255.255.0

Default Gateway .

在 /etc/httpd/conf 中.d/phpMyAdmin.conf 更改:

AddDefaultCharset UTF-8

<IfModule mod_authz_core.c>

  # Apache 2.4

  <RequireAny>

    Require ip 127.0.0.1

    Require ip ::1

  </RequireAny>

</IfModule>

<IfModule !mod_authz_core.c>

  # Apache 2.2

  Order Deny,Allow

  Deny from All

  Allow from 127.0.0.1

  Allow from ::1

</IfModule>

到:

AddDefaultCharset UTF-8

<IfModule mod_authz_core.c>

  # Apache 2.4

  <RequireAny>

    Require ip 127.0.0.1

    Require ip ::1

  </RequireAny>

</IfModule>

<IfModule !mod_authz_core.c>

  # Apache 2.2

  Order Deny,Allow

  Deny from All

  Allow from 127.0.0.1

  Allow from ::1

</IfModule>

<IfModule mod_authz_core.c>

  # Apache 2.4

  <RequireAny>

    Require ip [ WINDOWS IP TO ALLOW GOES HERE ]

    Require ip ::1

  </RequireAny>

</IfModule>

<IfModule !mod_authz_core.c>

  # Apache 2.2

  Order Deny,Allow

  Deny from All

  Allow from [ WINDOWS IP TO ALLOW GOES HERE ]

  Allow from ::1

</IfModule>

服务 httpd 重新启动

更改 $cfg['Servers'][$i]['auth_type'] = 'cookie';到 $cfg['服务器'][$i]
['auth_type'] = 'http';

service httpd restart

/etc/selinux/config change

此文件控制系统上 SELinux 的状态。

SELINUX= 可以采用以下三个值之一:

enforcing - 强制执行 SELinux 安全策略。

宽容 - SELinux 打印警告而不是强制。

已禁用 - 未加载 SELinux 策略。

SELINUX=enforcing

SELINUXTYPE= 可以采用三个两个值之一:

targeted - 目标进程受到保护,

minimum - 修改目标策略。仅选定的进程
受保护。

mls - 多级安全保护。

SELINUXTYPE=targeted

to

此文件控制系统上 SELinux 的状态。

SELINUX= 可以采用以下三个值之一:

enforcing - 强制执行 SELinux 安全策略。

宽容 - SELinux 打印警告而不是强制。

已禁用 - 未加载 SELinux 策略。

SELINUX=disabled

SELINUXTYPE= 可以采用三个两个值之一:

targeted - 目标进程受到保护,

minimum - 修改目标策略。仅选定的进程
受保护。

mls - 多级安全保护。

SELINUXTYPE=有针对性地

重新启动 centos

在 WINDOWS 中将浏览器指向:http://192.168.170.128/phpmyadmin,应该一切都好

将网站复制到: /var/www/html/[ 网站名称 ]

chmod -R 777 html

in etc/httpd/ add (这允许永久链接与帖子名称一起使用)

选项 FollowSymLinks

AllowOverride All

Order 允许,拒绝

允许所有

yum install php-devel (以允许 pipsize )

使用以下内容创建 php 文件:并复制到网站根目录运行它并将 htl 复制到 https://xdebug.org/wizard.php 然后点击分析源码按钮

https://xdebug.org/wizard.php 会给出这样的指令:(遵循它们)

......
下载 xdebug-2.4.1.tgz

  • 使用 tar -xvzf xdebug-2.4.1.tgz 解压下载的文件

  • 运行: cd xdebug-2.4.1

  • 运行:phpize(如果没有 phpize,请参阅常见问题解答。

  • 运行:./configure

  • 运行:make

  • 运行:cp module/xdebug.so /usr/lib64 /php/modules

  • 编辑 /etc/php.ini 并添加行

  • zend_extension = /usr/lib64/php/modules/xdebug.so

  • xdebug.remote_enable=On

  • xdebug.remote_host=192.168.170.1

  • xdebug.remote_port=9000

  • xdebug.remote_handler= dbgp

.....
service httpd restart

run 文件,您应该看到一个 XDebug 部分,如果是这样的话
服务器已准备就绪!

下载 Eclipse Neon

文件 >从文件系统打开项目

完成(并等待)

窗口首选项> php>服务器>新的

  • 服务器选项卡

    • 服务器名称 [无论您喜欢什么]

    • 基本网址 [IP 或服务器名称]

    • 文档根目录 [所有代码在硬盘上的位置,必须与服务器上的位置相同]

    调试器选项卡

    • 调试器:Xdebug

    • 端口:9000

    服务器映射选项卡(单击“添加”)

    • 服务器上的路径:[网站的完整路径] EG:/var/www/html/website

    • 工作区中的路径[查找您添加的项目:从文件系统打开项目]

转到eclipse主窗口> >单击错误图标旁边的下拉箭头 >调试配置

  • 服务器选项卡

    • 文件:[这应该是本地项目中的第一个文件
      应用程序打开时运行]

    • URL:关闭自动生成:取消选中它

      • URL 第一个文本框:[运行网站的服务器的 IP 或名称]

      • URL 第二个文本框:[如果您的网站不在根目录中,则位于此处的目录]

  • 公共选项卡

    • 在收藏夹菜单中显示

      • 单击“调试”(复选框)

窗口 >展望>开放视角> php

在首先被击中的 php 文件中放置一个断点(通过单击一行代码上的垂直滚动条)

最后单击 eclipse 中的调试图标,您的断点应该被击中(带有断点的代码行)在


Vemware 上向世界开放 Centos 7


将 VMeere 网络设置更改为桥接

将规则添加到路由器以端口将任何流量转发到运行 cetnos 的 vmweare IP 将入

站规则添加到 widnows 防火墙,允许 http

PS:我没时间检查我的gammer和speing,处理一下

This has been pissing me off for about 3 hours, just worked it out. So before you put a gun to your head, try this. When Eclipse starts, choose a new workspace, and setup your project again!

After I did this my break points got hit again!
My break points were working fine, then all-of-a-sudden they stopped working.
I Tried:

  1. removing all break points

  2. cleaning project

  3. re installing eclipse

NONE of the above worked for me!

BTW I am using window 7.

I hope this information saves someone's life!

BTW: here are the steps you take to setup, centos 7 with xdebug and vmwere, with a window 7 client with eclipse:

download vmwere

downlaod and setup vmwere with: CentOS-7-x86_64-Everything-1511.iso

disable Firewall

systemctl disable firewalld

systemctl stop firewalld

systemctl status firewalld

connect via ftp

ifconfig to find out Ip

ifconfig

eno16777736: flags=4163 mtu 1500

inet 192.168.170.128 netmask 255.255.255.0 broadcast 192.168.170.255

inet6 fe80::20c:29ff:fec4:b8ca prefixlen 64 scopeid 0x20

ether 00:0c:29:c4:b8:ca txqueuelen 1000 (Ethernet)

RX packets 254 bytes 20919 (20.4 KiB)

RX errors 0 dropped 0 overruns 0 frame 0

TX packets 95 bytes 10225 (9.9 KiB)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

192.168.170.128 is the ip

setup LAMP

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*

yum -y install epel-release

yum -y install mariadb-server mariadb

systemctl start mariadb.service

systemctl enable mariadb.service

mysql_secure_installation

yum -y install httpd

systemctl start httpd.service

systemctl enable httpd.service

yum -y install php

service httpd restart

yum -y install php-mysql

yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring

php-snmp php-soap curl curl-devel

service httpd restart

yum install phpMyAdmin

on windows open cmd, type ipconfig

find

Ethernet adapter VMware Network Adapter VMnet8:

Connection-specific DNS Suffix  . : localdomain

Link-local IPv6 Address . . . . . : fe80::94b8:9e5c:c772:3d47%19

IPv4 Address. . . . . . . . . . . : 192.168.170.1 [ this is the widnows ip to allow ]

Subnet Mask . . . . . . . . . . . : 255.255.255.0

Default Gateway .

in /etc/httpd/conf.d/phpMyAdmin.conf change:

AddDefaultCharset UTF-8

<IfModule mod_authz_core.c>

  # Apache 2.4

  <RequireAny>

    Require ip 127.0.0.1

    Require ip ::1

  </RequireAny>

</IfModule>

<IfModule !mod_authz_core.c>

  # Apache 2.2

  Order Deny,Allow

  Deny from All

  Allow from 127.0.0.1

  Allow from ::1

</IfModule>

to:

AddDefaultCharset UTF-8

<IfModule mod_authz_core.c>

  # Apache 2.4

  <RequireAny>

    Require ip 127.0.0.1

    Require ip ::1

  </RequireAny>

</IfModule>

<IfModule !mod_authz_core.c>

  # Apache 2.2

  Order Deny,Allow

  Deny from All

  Allow from 127.0.0.1

  Allow from ::1

</IfModule>

<IfModule mod_authz_core.c>

  # Apache 2.4

  <RequireAny>

    Require ip [ WINDOWS IP TO ALLOW GOES HERE ]

    Require ip ::1

  </RequireAny>

</IfModule>

<IfModule !mod_authz_core.c>

  # Apache 2.2

  Order Deny,Allow

  Deny from All

  Allow from [ WINDOWS IP TO ALLOW GOES HERE ]

  Allow from ::1

</IfModule>

service httpd restart

change $cfg['Servers'][$i]['auth_type'] = 'cookie'; to $cfg['Servers'][$i]
['auth_type'] = 'http';

service httpd restart

/etc/selinux/config change

This file controls the state of SELinux on the system.

SELINUX= can take one of these three values:

enforcing - SELinux security policy is enforced.

permissive - SELinux prints warnings instead of enforcing.

disabled - No SELinux policy is loaded.

SELINUX=enforcing

SELINUXTYPE= can take one of three two values:

targeted - Targeted processes are protected,

minimum - Modification of targeted policy. Only selected processes are
protected.

mls - Multi Level Security protection.

SELINUXTYPE=targeted

to

This file controls the state of SELinux on the system.

SELINUX= can take one of these three values:

enforcing - SELinux security policy is enforced.

permissive - SELinux prints warnings instead of enforcing.

disabled - No SELinux policy is loaded.

SELINUX=disabled

SELINUXTYPE= can take one of three two values:

targeted - Targeted processes are protected,

minimum - Modification of targeted policy. Only selected processes are
protected.

mls - Multi Level Security protection.

SELINUXTYPE=targeted

reboot centos

IN WINDOWS POINT BROWSER TO: http://192.168.170.128/phpmyadmin, should be all good

copy website to: /var/www/html/[ WEBSITE NAME ]

chmod -R 777 html

in etc/httpd/ add ( this allows permalinks to work with post name )

Options FollowSymLinks

AllowOverride All

Order allow,deny

Allow from all

yum install php-devel ( to allow pipsize )

make php file with: and copy to website root run it and copy the htl into https://xdebug.org/wizard.php then click analysis source button

https://xdebug.org/wizard.php will give Instructions like this: ( follow them )

......
Download xdebug-2.4.1.tgz

  • Unpack the downloaded file with tar -xvzf xdebug-2.4.1.tgz

  • Run: cd xdebug-2.4.1

  • Run: phpize (See the FAQ if you don't have phpize.

  • Run: ./configure

  • Run: make

  • Run: cp modules/xdebug.so /usr/lib64/php/modules

  • Edit /etc/php.ini and add the lines

  • zend_extension = /usr/lib64/php/modules/xdebug.so

  • xdebug.remote_enable=On

  • xdebug.remote_host=192.168.170.1

  • xdebug.remote_port=9000

  • xdebug.remote_handler=dbgp

.....
service httpd restart

run file and you should see an XDebug section, if so the
server is ready to go!

Download Eclipse Neon

File > Open projects from file system

Finish ( and wait )

Window Preferences > php > servers > new

  • Server Tab

    • Server Name [ what ever you like ]

    • Base Url [ IP or name of your server ]

    • Document Root [ Location on your hard drive where all the code is, must be same as what you have on the server]

    Debugger Tab

    • Debugger: Xdebug

    • port: 9000

    Server Mapping tab ( click add)

    • Path on Server: [the whole path to your website] EG: /var/www/html/website

    • Path in Workspace [find the project you added with: Open projects from file system]

go to eclipse main window > click drop down arrow beside the bug icon > debug configerations

  • Server Tab

    • File: [ this should be the first file in your local project that will be
      run when you app opens ]

    • URL: turn off auto generate : uncheck it

      • URL first text box: [ The IP or name of your server where you website is running ]

      • URL second text box: [ If your website is not in the root direcory, the direcory where it is goes here ]

  • Common Tab

    • Display in Favorites Menu

      • Click Debug ( checkbox )

window > prespective > open prespective > php

Put a break point in the php file that gets hit first ( by clicking on the vertial scrollbar on a line of code )

Finally click the debug icon in eclipse, and your break point should get hit ( the line of code with the break point on it will go green )


Open up Centos 7 on Vemware to the world


Change VMeere network setting to bridged

Add a rule to router to port foward any traffic to the vmweare IP that cetnos is running on

Add an inbound rule to the widnows firewall allowing http

PS: I dont have time to check my gammer and speiing, deal with it

我三岁 2024-10-06 06:13:40

如果 xdebug 没有在代码的任何部分停止,请将 xdebug_break() 添加到这部分代码。

If xdebug do not stop in any part of your code, add xdebug_break() to this part of the code.

一杆小烟枪 2024-10-06 06:13:40

似乎有几个问题可能是此问题的根源。就我而言,事实上我认为我需要设置一些路径映射。


下找到的设置
右键-项目->属性->PHP调试
然后
服务器->编辑->路径映射
错了。

我手动添加了一些我认为是正确的内容,但 Eclipse 似乎可以自行完成这一切。删除映射使其工作。

There seem to be several issues that could be the root of this problem. In my case it was the fact that I thought I needed to set some path mapping.

The settings found under
rightclick-project->properties->PHP Debug
and then
server->edit->path mapping
were wrong.

I had manually added something I though was correct, but Eclipse can do this all by its self it seems. Removing the mapping made it work.

两相知 2024-10-06 06:13:40

我在 Eclipse PDT 和 Xdebug 上也遇到过类似的问题。原因是 Eclipse 正在通过 IPv6 监听,但 Xdebug 尝试通过 IPv4 连接:

chriki@machine:~$ netstat -an | grep 9000
tcp6       0      0 :::9000                 :::*                    LISTEN

Xdebug doesn't似乎还支持 IPv6

在我的 eclipse.ini 文件中的 -vmargs 行后面添加该行后

-Djava.net.preferIPv4Stack=true

,Eclipse 开始通过 IPv4 进行侦听:

chriki@machine:~$ netstat -an | grep 9000
tcp        0      0 0.0.0.0:9000            0.0.0.0:*               LISTEN

调试现在可以完美运行。

I’ve had a similar problem with Eclipse PDT and Xdebug. The cause was that Eclipse was listening via IPv6 but Xdebug tried to connect via IPv4:

chriki@machine:~$ netstat -an | grep 9000
tcp6       0      0 :::9000                 :::*                    LISTEN

Xdebug doesn’t seem to support IPv6, yet.

After adding the line

-Djava.net.preferIPv4Stack=true

after the -vmargs line in my eclipse.ini file, Eclipse started to listen via IPv4:

chriki@machine:~$ netstat -an | grep 9000
tcp        0      0 0.0.0.0:9000            0.0.0.0:*               LISTEN

Debugging now works flawlessly.

北方的巷 2024-10-06 06:13:40

我已经解决了自己的问题。

在我的 php.ini 上,我添加了 xdebug 作为扩展,而不是 zend_extension。

php.ini

zend_extension=C:\EasyPHP-5.3.3\php\ext\php_xdebug.dll

注意:路径必须是完整路径,而不是相对路径。

调试器工作得很好。好吃!

I have fixed myself the problem.

On my php.ini, I have add the xdebug as an extension instead of a zend_extension.

php.ini

zend_extension=C:\EasyPHP-5.3.3\php\ext\php_xdebug.dll

Note: the path must be the full path instead of a relative path.

The debugger works great. Yummy!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文