使用MAMP在Mac OSX上构建/安装XDebug

时间:2012-07-08 01:02:05

标签: php osx-lion mamp xdebug

我在使用MAMP在Mac OSX上构建/安装XDebug时遇到问题。

到目前为止,我在网上进行了广泛的搜索,目前我被困在XDebug“安装向导”的一部分,它告诉我在我下载的源代码上“运行:phpize”。

当我运行phpize时,我收到以下消息:

new-host-2:xdebug-2.2.0 Dima$ phpize
grep: /usr/include/php/main/php.h: No such file or directory
grep: /usr/include/php/Zend/zend_modules.h: No such file or directory
grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:        
Zend Module Api No:     
Zend Extension Api No:  
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

如果我做which phpize我得到:

new-host-2:xdebug-2.2.0 Dima$ which phpize
/usr/bin/phpize

这不是我想要使用的版本,我想使用MAMP安装的phpize版本我假设因为我想在MAMP版本的PHP上安装XDebug。这很令人费解,因为我已将MAMP特定的PHP bin路径添加到我的.bash_profile已经放入$PATH变量。

如果我运行echo $PATH我得到:

new-host-2:xdebug-2.2.0 Dima$ echo $PATH
/opt/local/bin:/opt/local/sbin:/Applications/MAMP/bin/php/php5.4.3/bin:/Users/Dima/.rvm/gems/ruby-1.9.2-p290/bin:/Users/Dima/.rvm/gems/ruby-1.9.2-p290@global/bin:/Users/Dima/.rvm/rubies/ruby-1.9.2-p290/bin:/Users/Dima/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

MAMP特定的PHP路径显示在'/ usr / bin'之前。我接下来尝试的是运行特定于MAMP的phpize,如下所示手动提供整个路径:

new-host-2:xdebug-2.2.0 Dima$ /Applications/MAMP/bin/php/php5.4.3/bin/phpize 
-bash: /Applications/MAMP/bin/php/php5.4.3/bin/phpize: Permission denied

现在我在Finder中检查了这些文件的权限,它表明我拥有读取和写入此文件夹文件的完全权限。我有点失落。任何帮助将非常感激。如果有助于诊断此问题,我可以发布任何其他信息。

4 个答案:

答案 0 :(得分:12)

有同样的问题,但找到了更好的解决方案

xDebug已经在MAMP中。

检查你的php.ini

/Applications/MAMP/conf/php5.x/php.ini

一路走下去。你会看到

[xdebug]
;zend_extension="/Applications/MAMP/bin/php5.X/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"

将其更改为

[xdebug]
zend_extension="/Applications/MAMP/bin/php5.X/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler=dbgp

重启服务器...完成!

http://danpolant.com/want-to-run-xdebug-mamp-is-the-easiest-way/

答案 1 :(得分:8)

我尝试了上述内容,但我并没有为我工作,所以我用Google搜索了更多内容,这就是诀窍。

  1. 从SourceForge

  2. 下载并解压缩MAMP Components
  3. 记下在phpize过程中找不到的路径,对我来说是:

    /Applications/MAMP/bin/php/php5.2.17/include/php/main/php.h
    
    /Applications/MAMP/bin/php/php5.2.17/include/php/Zend/zend_modules.h
    
    /Applications/MAMP/bin/php/php5.2.17/include/php/Zend/zend_extensions.h
    
  4. 在MAMP php目录中创建所需的路径,对我来说再次

    /include/php/
    
  5. 确保对目录的正确权限

  6. 找到目标PHP版本的组件(在我的情况下为5.2.17),并将它们复制到您在步骤3中创建的路径中。

  7. Xdebug site

  8. 运行使用正确版本的phpize的说明

    我希望能帮助别人,因为我花了太长时间来解决这个问题!

答案 2 :(得分:3)

经过更多研究和反复试验后,我设法在完成以下事项后安装它:

  1. 在终端中,我运行chmod u+x /Applications/MAMP/bin/php/php5.4.3/bin/*打开phpize和该路径中其他所有内容的执行权限
  2. 按照this article安装命令行工具
  3. 按照this article安装最新的autoconf及相关工具
  4. 之后,XDebug Wizard提供的步骤顺利完成
  5. 但这是一个令人头痛的问题。希望这个答案将在未来节省一些时间。

答案 3 :(得分:0)

很容易 在C:\ MAMP \ conf \ php x.x.x \目录下打开每个与php.ini相关的内容 然后将这些行放在php.ini

    [xdebug]

xdebug.default_enable=1

xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1

zend_extension="C:\MAMP\bin\php\php5.5.0\ext\php_xdebug.dll"
相关问题