gpt4 book ai didi

xdebug 未加载。 apache 重启后在 phpinfo() 中找不到

转载 作者:行者123 更新时间:2023-12-02 06:24:30 25 4
gpt4 key购买 nike

我一直在搜寻我能找到的所有资源,但一无所获。当我启动调试 session 时,我在 NetBeans 6.9 中收到可怕的“等待连接”消息。经过大量阅读,大多数人都能够让 phpinfo() 显示它加载了 xdebug 模块。我不是这样。

我使用这个调用通过SVN下载了源

svn co svn://svn.xdebug.org/svn/xdebug/xdebug/trunk xdebug

我切换到 xdebug 目录,然后在源上运行 phpize

sudo /Applications/MAMP/bin/php5/bin/phpize
Password:
grep: /Applications/MAMP/bin/php5/include/php/main/php.h: No such file or directory
grep: /Applications/MAMP/bin/php5/include/php/Zend/zend_modules.h: No such file or directory
grep: /Applications/MAMP/bin/php5/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:

一个大胖子罢了!引用的目录甚至不存在。因此,我假设我在这一点之外所做的任何 .ini 调整都是无用的。如果我执行 whereis php,我会在/usr/bin 中找到它。这是操作系统预加载的默认 php。我不想要那个。我需要使用随 MAMP 安装的 php。我无法相信让这个东西工作是多么令人沮丧!

作为记录,我的 php.ini 中的 xdebug 部分如下所示:

[xdebug]
; xdebug config for Linux and Mac OS X
zend_extension="/Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey="netbeans-xdebug"
xdebug.profiler_enable=1
xdebug.profiler_output_name=xdebug.cachegrind-out.%s.%p
xdebug.remote_log="/Applications/MAMP/logs/xdebug_log.log"

这是使 xdebug 工作的许多不同尝试的大杂烩。所以,我不知道哪些片段有效。

我任由专家摆布,因为我显然不是他们中的一员。我现在完全不知道如何继续。

提前致谢。

最佳答案

要在 MAMP 目录而不是系统路径中使用 phpize,您应该将 MAMP 的 PHP 二进制文件目录添加到 $PATH。下面我使用的是 MAMP 1.9.1,它提供 PHP 5.2 和 PHP 5.3。我们假设您正在为 PHP 5.3 进行编译。

打开或创建~/.bash_profile并放入以下内容:

#Add MAMP binaries to path
export PATH="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php5.3/bin:$PATH"

您可能还需要将 /Applications/MAMP/bin/php5.3/bin 中的二进制文件更改为可执行文件:

chmod 755 /Applications/MAMP/bin/php5.3/bin/pear
chmod 755 /Applications/MAMP/bin/php5.3/bin/peardev
chmod 755 /Applications/MAMP/bin/php5.3/bin/pecl
chmod 755 /Applications/MAMP/bin/php5.3/bin/phar
chmod 755 /Applications/MAMP/bin/php5.3/bin/phar.phar
chmod 755 /Applications/MAMP/bin/php5.3/bin/php
chmod 755 /Applications/MAMP/bin/php5.3/bin/php-config
chmod 755 /Applications/MAMP/bin/php5.3/bin/phpcov
chmod 755 /Applications/MAMP/bin/php5.3/bin/phpize

重新启动终端 session 以加载新的 $PATH。运行命令 which phpize,它应该显示 /Applications/MAMP/bin/php5.3/bin/phpize。如果不是,则您的 MAMP 目录中 phpize 的路径未加载到您的 $PATH 中。在终端中使用 echo $PATH 确保 /Applications/MAMP/bin/php5.3/bin 在 $PATH 中。

要编译 xDebug,您需要编译 PHP 时的头文件。这些在 DMG 的 MAMP 网站上可用,称为“MAMP 组件”:http://www.mamp.info/en/downloads/index.html

解压 MAMP 组件并将 MAMP_src 复制到您的桌面。解压 MAMP_src/php-5.3.2.tar.gz 并将其移动到 php-config --includes 中的包含路径中,该路径应包含 /Applications/MAMP/bin/php5.3/include/php.

cd ~/Desktop/MAMP_src
tar -xvzf php-5.3.2.tar.gz
mkdir -p /Applications/MAMP/bin/php5.3/include
mv php-5.3.2/ /Applications/MAMP/bin/php5.3/include/php

您现在可以在 xDebug 源目录中运行 phpize

关于xdebug 未加载。 apache 重启后在 phpinfo() 中找不到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3144485/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com