Apache 未加载 Xdebug,但从命令行启动时会加载 Xdebug

发布于 2024-08-20 13:26:05 字数 496 浏览 6 评论 0原文

我知道这听起来很奇怪,但相信我,这就是正在发生的事情。这是我的系统设置:

Windows7
阿帕奇2.2
PHP 5.2.12
Xdebug 2.0.5

我在 PHP.ini 文件中配置了 XDebug。当我运行 php -m 时,我确实看到 Xdebug 已加载。现在,如果我启动 Apache 作为服务(或通过 Apache Monitor),并运行 phpinfo(),它不会显示 Xdebug 正在加载。

然而,(现在这是疯狂的部分),如果我进入我的 Apache bin 目录,然后简单地运行 httpd.exe,然后去查看 phpinfo(),Xdebug 现在显示为正在加载!

另外,比较通过服务或命令行启动时的一些 phpinfo() ,看起来两种情况下的 php.ini 文件都是相同的。除了正在加载的 Xdebug 部分之外,一切看起来都一样。

请,如果您有任何想法,我们将不胜感激。

I know that this sounds odd, but believe me, it's what is happening. Here are my system settings:

Windows7
Apache 2.2
PHP 5.2.12
Xdebug 2.0.5

I have XDebug configured in my PHP.ini file. When I run php -m, I do in fact see that Xdebug is loaded. Now, if I start Apache AS A SERVICE (or by the Apache Monitor), and run phpinfo(), it is NOT showing Xdebug as being loaded.

However, (now here's the crazy part), if I go to my Apache bin directory, and simply run httpd.exe, and then go and look at phpinfo(), Xdebug now shows as being loaded!

Also, comparing some phpinfo() when started via service or by command line, it looks like the php.ini file is the same for either case. Everything looks the same except for the Xdebug being loaded part.

Please, if you have any ideas it would be greatly appreciated.

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

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

发布评论

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

评论(6

嘿咻 2024-08-27 13:26:05

我最近遇到了同样的问题,但我必须对 SELinux 进行针孔处理,以允许 httpd 访问 xdebug.so 模块:

chcon -v -R --type=httpd_sys_content_t /path/to/your/xdebug.so

重新启动 httpd,一切都按预期工作。

I recently ran into the same issue, but I had to pinhole SELinux to allow httpd access to the xdebug.so module:

chcon -v -R --type=httpd_sys_content_t /path/to/your/xdebug.so

Restarted httpd and everything worked as expected.

信愁 2024-08-27 13:26:05

我在 Windows/IIS 中的 Xdebug 中遇到了类似的问题 - php -m 显示模块已加载,但 phpinfo() 没有。事实证明这是一个权限问题 - 一旦我将 xdebug .dll 设置为向匿名用户提供读取权限,它就开始工作。我会检查该 .dll 的权限,以确保 Apache 正在运行的任何用户都可以访问它。

I had a similar problem with Xdebug in Windows/IIS - php -m showed the module as loaded, but phpinfo() did not. Turned out to be a permissions issue - once I set the xdebug .dll to give read access to anonymous users, it started working. I'd check permissions on that .dll to make sure that whatever user Apache is running as has access to it.

岁月静好 2024-08-27 13:26:05

一般来说,调用 php 实例的每种可能方式都有不同的配置文件:HTTP/CLI 等(至少在 *nix 上可能是这种情况)

我建议在您的系统上搜索 php*ini 并看看您是否有多个文件具有不同/缺失的 Xdebug 设置。

Generally there is different configuration files for each possible way of invoking an instance of php: HTTP/CLI etc (at least this can be the case on *nix)

I would suggest doing a search on your system for php*ini and see if you have multiple files with differing/missing Xdebug settings.

给妤﹃绝世温柔 2024-08-27 13:26:05

这可能是一个有缺陷的版本/组合。我有一个不同的问题(XDebug 无法识别某些变量),当我升级到 2.1.0 时,问题就解决了。

http://xdebug.org/download.php

It's possibly a buggy version/combination. I had a different issue (XDebug was not recognising some variables), the problem cleared up when I when up to 2.1.0.

http://xdebug.org/download.php

十六岁半 2024-08-27 13:26:05

我遇到了这个问题,发现它是由于我的 php.ini 中使用正斜杠而不是反斜杠引起的。
所以尝试:
C:\php\ext\xdebug.dll
而不是
C:/php/ext/xdebug.dll

I had this problem and found out it was caused by having foward slashes in my php.ini instead of backslashes.
So try:
C:\php\ext\xdebug.dll
instead of
C:/php/ext/xdebug.dll

热情消退 2024-08-27 13:26:05

Mike Purcell,你说得几乎是对的......

在新的 Red Hat 和其他 Linux 发行版中,SELinux 被启用(糟透了大发行版)并阻止 Apache 生成的子进程(例如 xdebug.so)执行某些操作,例如访问网络。

因此,您需要使用以下命令禁用 SElinux:

vi /etc/selinux/config 

SELINUX=disabled

so 并重新启动,这将禁用 SE Linux 并且 X-Debug 将开始工作...
为此杀了一整天,希望它能帮助别人。

这也是 Amazon EC2 和 AWS Linux 服务器的设置方式...

Sean。

Mike Purcell, you had it ALMOST right...

In new Red Hat and other Linux distributions the SELinux is enabled (sucks the big one) and blocks Apache spawned childs (such as xdebug.so) from doing certain things, like accessing the web.

Thus you need to disable SElinux using:

vi /etc/selinux/config 

SELINUX=disabled

so and reboot, this will disable SE Linux and X-Debug will begin working ...
Killed a whole day cause of this, hope it helps someone..

This is also how Amazon EC2 and AWS Linux servers are setup...

Sean.

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