在阅读有关Snow Leopard上的内置 Apache/PHP 的一些帖子之前,我使用MAMP (标准)进行 PHP 开发有一段时间了。我决定转向那些我提供但似乎有很多问题的人。
第一件事是当我使用 MAMP 时,我参考这篇文章将 PEAR 从 1.9.0 升级到 1.9.1(以便稍后安装 PHPUnit)。该phpunit
命令对我来说效果很好。我也有 Xcode4,但几周前将其删除(我提到这一点是因为我不知道是什么导致了我所有的麻烦)。
然后,当我尝试在 Snow Leopard 上使用默认的 Apache 和 PHP 时,我意识到我的 Mac 上可能有两个版本的 PHP。
当我尝试撤销php -i
命令时,第一个是 5.3.3:
PHP 5.3.3 (cli) (built: Aug 22 2010 19:41:55)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
第二个是 5.3.4,当我使用phpinfo()
或调用此php-config --version
命令运行文件时,它实际上会显示出来。请看下面的截图:
==================================================== ========================
我的另一个问题是使用PECL安装xdebug。您可以从上面的命令中看到来自 Komodo 的预编译 xdebug.so(我阅读了这篇文章),而不是 PECL 安装的内容,因为每次我尝试安装 xdebug 时,都会出现以下错误:php -i
ngocminh@MBP[447]:~$ cd /usr/local/pear/bin/
ngocminh@MBP[448]:bin$ sudo ./pecl install xdebug
downloading xdebug-2.1.1.tgz ...
Starting to download xdebug-2.1.1.tgz (303,198 bytes)
..............................................................done: 303,198 bytes
66 source files, building
running: 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.
ERROR: `phpize' failed
在为他们上网一整天后,不知道这些烂摊子。请帮我弄清楚。如果您愿意,请随时向我询问更多详细信息。谢谢!!!
--编辑1: which php
ngocminh@MBP[449]:bin$ which php
/usr/bin/php