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

发布于 2024-09-07 08:44:16 字数 1587 浏览 5 评论 0原文

我一直在搜寻我能找到的所有资源,但一无所获。当我启动调试会话时,我在 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 工作的许多不同尝试的大杂烩。所以,我不知道哪些部分是有效的,哪些部分是无效的。

我把自己置于专家的怜悯之下,因为我显然不是他们中的一员。我现在完全不知道如何进行。

提前致谢。

I've been scouring every resource I could find, but came up empty. I get the dreaded "Waiting for Connection" message in NetBeans 6.9 when I start a debug session. After much reading, most folks are able to get phpinfo() to display that it loaded the xdebug module. Not so with me.

I downloaded the source through SVN using this call

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

I switched to the xdebug directory and then ran phpize on the source

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:  

A big fat nothing! The referenced directories don't even exist. So, I make the assumption that any .ini tweaking I do beyond this point is useless. If I do a whereis php, I find it in /usr/bin. That's the default php pre-loaded with the OS. I don't want that one. I need to use the php installed with MAMP. I cannot believe how insanely frustrating it is to get this thing working!

For the record, my xdebug section in my php.ini looks like this:

[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"

It's a mish-mash of many different attempts to get xdebug to work. So, I don't know which pieces are valid or not.

I throw myself on the mercy of the experts because I obviously am not one of them. I have absolutely no idea how to proceed at this point.

Thanks in advance.

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

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

发布评论

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

评论(3

层林尽染 2024-09-14 08:44:16

要在 MAMP 目录而不是系统路径中使用 phpize,您应该将 PHP 二进制文件的 MAMP 目录添加到 $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"

您可能还需要 chmod /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

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

要编译 xDebug,您需要编译 PHP 时的头文件。这些可以在 MAMP 网站上的 DMG 中找到,称为“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。

To use phpize in the MAMP directory instead of your system path, you should add MAMP's directory for PHP binaries to your $PATH. Below I'm using MAMP 1.9.1, which offers PHP 5.2 and PHP 5.3. We'll assume you're compiling for PHP 5.3.

Open or create ~/.bash_profile and put the following contents:

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

You may also need to chmod the binaries inside /Applications/MAMP/bin/php5.3/bin to be executable:

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

Restart your Terminal session for the new $PATH to be loaded. Run the command which phpize and it should display /Applications/MAMP/bin/php5.3/bin/phpize. If not, the path to phpize in your MAMP directory is not being loaded in your $PATH. Use echo $PATH in Terminal to make sure /Applications/MAMP/bin/php5.3/bin is in the $PATH.

To get xDebug to compile, you need the header files from when PHP was compiled. These are available on the MAMP website in a DMG, and called "MAMP Components": http://www.mamp.info/en/downloads/index.html

Unpack MAMP Components and copy MAMP_src to your Desktop. Unpack MAMP_src/php-5.3.2.tar.gz and move it into the include path present in php-config --includes which should include /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

You can now run phpize in the xDebug source dir.

无声静候 2024-09-14 08:44:16

我在 Mac OSX 10.6 上使用 XAMPP 时遇到了类似的问题。

在 xdebug 下载目录中运行 phpize 时,我没有得到版本号。

PHP Api Version:        
Zend Module Api No:     
Zend Extension Api No

我必须安装“开发包”,它将 /Applications/XAMPP/xamppfiles/include 和其他文件添加到您的 XAMPP 安装中。安装开发包也修复了pecl,所以我尝试使用pecl来安装xdebug。

pecl install xdebug

但 apache 无法启动并出现错误

Failed loading /Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/xdebug.so:  dlopen(/Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/xdebug.so, 9): no suitable image found.  Did find:
        /Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/xdebug.so: mach-o, but wrong architecture

我尝试从源代码编译并得到相同的 '错误的架构'错误

最后我只使用了 KomodoIDE 二进制文件从活动状态有效。

I had a similar problem with XAMPP on Mac OSX 10.6.

I got no version Numbers when running phpize in the xdebug download directory.

PHP Api Version:        
Zend Module Api No:     
Zend Extension Api No

I had to install the 'Development Package' which adds /Applications/XAMPP/xamppfiles/include and other files to your XAMPP install. Installing the Development Package also fixed pecl so I tried using pecl to install xdebug.

pecl install xdebug

but apache failed to start with error

Failed loading /Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/xdebug.so:  dlopen(/Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/xdebug.so, 9): no suitable image found.  Did find:
        /Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/xdebug.so: mach-o, but wrong architecture

I tried compiling from source and got the same 'wrong architecture' errors

Finally I just used the KomodoIDE binary from active state which worked.

过潦 2024-09-14 08:44:16

由于 PHP 5.3.1 的问题,我自己刚刚开始使用 xdebug。几周前我已经按照说明使用了 PECL,但看起来 phpize 是新的黑色。我查看了新指令(从我的 phpinfo() 生成)@ http://xdebug.org/find -binary.php

值得注意的是:有

Run: phpize

As part of its output it should show:

Configuring for:
PHP Api Version:         20090626
...
Zend Extension Api No:   220090626
If it does not, you are using the wrong phpize. Please follow this FAQ entry and skip the next step.

两件事:

  1. 您检查过 phpize 是否是最新的吗?

  2. 如果这不起作用,请尝试以下说明:http://xdebug.org/docs/install

I just started working with xdebug myself due to problems with PHP 5.3.1. I had used PECL per instructions a couple weeks ago but it looks like phpize is the new black. I looked over the new instructions (generated from my phpinfo()) @ http://xdebug.org/find-binary.php

this is of note:

Run: phpize

As part of its output it should show:

Configuring for:
PHP Api Version:         20090626
...
Zend Extension Api No:   220090626
If it does not, you are using the wrong phpize. Please follow this FAQ entry and skip the next step.

2 things:

  1. have you checked that phpize is up to date?

  2. if that doesnt work try these instructions: http://xdebug.org/docs/install

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