我在 apache 上运行 php。我已经下载了我认为适用于 php 版本 5.4 64 位 Windows 的正确 xdebug 编译的 dll。我启用了线程安全并且它正在使用 VC9。我已经下载了 dll 并将其放置在这里:
C:\php5\extras\php_xdebug-2.2.0RC1-5.4-vc9-x86_64.dll
这是我的 php.ini 中的内容:
[xdebug]
zend_extension = "C:\php5\extras\php_xdebug-2.2.0RC1-5.4-vc9-x86_64.dll"
当我启动 Apache 时,出现此错误:
[Wed Apr 04 17:01:56 2012] [notice] Parent: Received restart signal -- Restarting the server.
Failed loading C:\php5\extras\php_xdebug-2.2.0RC1-5.4-vc9-x86_64.dll
hild process is ending.
[Wed Apr 04 17:01:56 2012] [notice] Apache/2.2.22 (Win32) PHP/5.4.0 configured -- resuming normal operations
[Wed Apr 04 17:01:56 2012] [notice] Server built: Jan 28 2012 11:16:39
[Wed Apr 04 17:01:56 2012] [notice] Parent: Created child process 2120
[Wed Apr 04 17:01:57 2012] [notice] Child 2120: Child process is running
[Wed Apr 04 17:01:57 2012] [notice] Child 2120: Acquired the start mutex.
[Wed Apr 04 17:01:57 2012] [notice] Child 2120: Starting 64 worker threads.
[Wed Apr 04 17:01:57 2012] [notice] Child 5624: Released the start mutex
[Wed Apr 04 17:01:58 2012] [notice] Child 5624: All worker threads have exited.
[Wed Apr 04 17:01:58 2012] [notice] Child 5624: Child process is exiting
Failed loading C:\php5\extras\php_xdebug-2.2.0RC1-5.4-vc9-x86_64.dll
为了确保您下载了正确的二进制文件,您可以使用位于 http://xdebug.org/wizard.php 的向导 它会准确地告诉您要下载哪个文件以及哪个 php.ini 文件你应该放置 zend_extension 行(当然,你现在使用的是正确的,因为你收到“加载失败”错误)。
好的,现在可以运行了,我想我知道出了什么问题。我使用的是 64 位版本的 PHP,但使用的是 32 位版本的 Apache 和 64 位版本的 xdebug。我重新开始并使用 Apache 2.4 32 位,因为似乎没有带有 php5 模块的 64 位版本。因此,我确保我拥有所有内容的 32 位版本。我使用的是 php5.4 和 VC9,线程安全。
这篇博文有助于设置它: http://lifeofageekadmin.com/how-install-apache-2-4-php-5-4-and-mysql-5-5-21-on-windows-7/
我终于让它发挥作用了。 按照 xdebug 网站上的说明,我使用向导并将 dll 文件下载到“ext”目录。然后向导告诉我将此行添加到我的 php.ini 文件中:
zend_extension=ext\php_xdebug-2.3.3-5.6-vc11.dll
这给了我上面看到的错误:
Failed loading ext\php_xdebug-2.3.3-5.6-vc11.dll
我还尝试用正斜杠替换反斜杠,但这失败并显示消息:
Failed loading ext\ext/php_xdebug-2.3.3-5.6-vc11.dll
看着最后一条消息,我想可能是扩展目录引起了问题,我在我的 php.ini 文件中看到了这一行:
extension_dir = "ext"
所以我改为使用:
zend_extension=php_xdebug-2.3.3-5.6-vc11.dll
它成功了!!
在最新版本的
xampp
中,您只需将zend_extension=xdebug
添加到php.ini
即可,例如:
zend_extension=xdebug
[XDebug]
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "c:\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.trace_output_dir = "c:\xampp\php"
xdebug.remote_autostart=on
xdebug.remote_enable=on
xdebug.remote_connect_back=on
xdebug.remote_port=9000
xdebug.remote_mode=req
xdebug.idekey="PHPSTORM"
好吧,我知道这是一个非常古老的僵尸线程,但最近我自己也遇到了这个问题,结果发现有一个简单的解决方案。
PHP.INI 要求对目录使用正斜杠,而在 Windows 下安装 XDebug 的说明则使用反斜杠。所以对于上面的原始问题,解决方案是将 zend_extension 行更改为:
zend_extension =“C:/php5/extras/php_xdebug-2.2.0RC1-5.4-vc9-x86_64.dll”
希望这有帮助。
查看
C:\php5\ext
,看看 php_xdebug.dll
是否已在其中。如果没有,请尝试将 php_xdebug-2.2.0RC1-5.4-vc9-x86_64.dll
重命名为 php_xdebug.dll
并将其放入 C:\php5\ext
,然后将 php.ini
添加更改为:
[xdebug]
zend_extension = "C:\php5\ext\php_xdebug.dll"
有同样的问题。对我来说,我需要
zend_extension
的绝对路径,用引号引起来(但反斜杠也可以)。
我有Windows 7 64位和php v5.4.4,但我需要下载的x-debug版本是:
PHP 5.4 VC9(32位)(MD5:ffeb0215621d330fa53b249f0930ffae)
因为 IIS 无法与 xdebug 64 位一起工作
还有我的 php.ini 说明:
[Xdebug]
zend_extension="C:\Program Files (x86)\iis express\PHP\v5.4\ext\php_xdebug-2.4.0rc4-5.4-vc9-nts.dll"
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.profiler_enable=1
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "C:\temp\php"
xdebug.profiler_output_dir="C:\temp\php"
对于 PHP 5.6 等旧版本,该向导不起作用。请改用以下内容:
php.exe -i
C:\php\ext\
文件夹。 (假设这里安装了PHP)。php.ini
文件并在 [PHP] 部分下找到 ; Windows 扩展 评论。在扩展的末尾,添加这些行。
zend_extension = "C:\PHP\ext\php_xdebug-2.5.5-5.6-vc11.dll"
xdebug.remote_enable=1
xdebug.remote_host="localhost"
xdebug.remote_port=9000
C:\php.exe -v
,您应该会看到 Xdebug 已加载。如果您看到加载 dll 失败(第一条消息),那么很可能您下载了错误的 dll 文件。