xdebug无法加载. apache重启后在phpinfo()中找不到 [英] xdebug not loading. not found in phpinfo() after apache restart

查看:167
本文介绍了xdebug无法加载. apache重启后在phpinfo()中找不到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在搜寻我能找到的所有资源,但是却空无一物.启动调试会话时,我在NetBeans 6.9中收到可怕的等待连接"消息.经过大量阅读后,大多数人都可以获取phpinfo()来显示它已加载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.

我使用此调用通过SVN下载了源代码

I downloaded the source through SVN using this call

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

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

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:  

大胖没事!引用的目录甚至不存在.因此,我认为超出这一点所做的任何.ini调整都是无用的.如果我执行whereis php,则会在/usr/bin中找到它.那是操作系统预装的默认php.我不要那个我需要使用随MAMP一起安装的php.我不敢相信让这东西正常工作会多么令人沮丧!

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!

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

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"

这是使xdebug正常工作的许多尝试的混搭.所以,我不知道哪一部分是有效的.

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.

谢谢.

推荐答案

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

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.

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

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"

您可能还需要chmod /Applications/MAMP/bin/php5.3/bin中的二进制文件以使其可执行:

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

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

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.

要编译xDebug,您需要PHP编译时的头文件.这些可以在DAMP的MAMP网站上找到,并称为"MAMP组件": http://www.mamp.info/en/downloads/index.html

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

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

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

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

You can now run phpize in the xDebug source dir.

这篇关于xdebug无法加载. apache重启后在phpinfo()中找不到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆