Mac OS Snow Leopard上的两个版本的PHP和使用PECL安装xdebug

时间:2022-09-19 14:38:11

I was using MAMP (standard) for PHP Development for some times before I read some posts about built-in Apache/PHP on Snow Leopard. I decided to shift to those I am provided with but seems to have many problems.

在我阅读有关Snow Leopard内置Apache / PHP的一些帖子之前,我曾经使用MAMP(标准)进行PHP开发。我决定转向我提供的那些,但似乎有很多问题。

The first thing is when I was using MAMP, I upgraded PEAR from 1.9.0 to 1.9.1 (to install PHPUnit later) with reference from this post. It worked well for me with the phpunit command. I also have Xcode4 but removed it few weeks ago (I mention this because I don't know what could be the cause for all my troubles).

第一件事是当我使用MAMP时,我将PEAR从1.9.0升级到1.9.1(稍后安装PHPUnit),参考这篇文章。使用phpunit命令对我来说效果很好。我也有Xcode4,但几周前将它删除了(我提到这个因为我不知道造成我所有麻烦的原因是什么)。

Then, when I try to use default Apache and PHP on Snow Leopard, I realise that there're likely two versions of PHP on my Mac.

然后,当我尝试在Snow Leopard上使用默认的Apache和PHP时,我意识到我的Mac上可能有两个版本的PHP。

The first one is 5.3.3 when I try to revoke php -i command:

当我尝试撤销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

The second one is 5.3.4, that actually shows up when I ran a file with phpinfo() or invoke this php-config --version command. Please see the screenshot below:

第二个是5.3.4,当我用phpinfo()运行文件或调用这个php-config --version命令时实际显示。请看下面的截图:

Mac OS Snow Leopard上的两个版本的PHP和使用PECL安装xdebug

=========================================================================

Another problem for me is installing xdebug using PECL. What you can see from php -i command above is a pre-compiled xdebug.so from Komodo (I read this post), not what was installed by PECL as each time I try to install xdebug, these errors appear:

对我来说另一个问题是使用PECL安装xdebug。你可以从上面的php -i命令看到的是来自Komodo的预编译的xdebug.so(我读过这篇文章),而不是每当我尝试安装xdebug时PECL安装的内容,这些错误都会出现:

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

Have no idea about these mess after a whole day surfing the Internet for them. Please help me figure it out. Please do not hesitate asking me for more details if you want. Thank you!!!

在为他们上网一整天后,不知道这些混乱。请帮我搞清楚。如果你愿意,请不要犹豫,向我询问更多细节。谢谢!!!

--EDIT 1: which php

--EDIT 1:哪个php

ngocminh@MBP[449]:bin$ which php
/usr/bin/php

1 个解决方案

#1


1  

I recommend you stick with MAMP for several reasons

我建议你坚持使用MAMP有几个原因

  1. Software updates from apple may destroy the customizations you have done to your OS level versions of PHP and MySQL.

    来自apple的软件更新可能会破坏您对操作系统级别的PHP和MySQL所做的自定义。

  2. MAMP can be easily stopped and thus will only consume system resources when needed.

    MAMP可以很容易地停止,因此只在需要时消耗系统资源。

  3. It is less likely that changes to MAMP will effect any other parts of your system

    对MAMP的更改不太可能影响系统的任何其他部分

  4. You didn't indicate any reason for switching so you are causing yourself unnecessary headache and work just to possibly get back to a point where you already are with MAMP

    你没有指出任何转换的原因,所以你造成了不必要的头痛,并且工作只是为了可能回到你已经和MAMP在一起的地步

I use the Komodo binaries to run XDebug through MAMP. I would recommend doing the same unless there is a reason to install your own through PECL. This post may be relevant to you if you need to access php from the command line.

我使用Komodo二进制文件通过MAMP运行XDebug。我建议做同样的事情,除非有理由通过PECL安装自己的。如果您需要从命令行访问php,这篇文章可能与您有关。

#1


1  

I recommend you stick with MAMP for several reasons

我建议你坚持使用MAMP有几个原因

  1. Software updates from apple may destroy the customizations you have done to your OS level versions of PHP and MySQL.

    来自apple的软件更新可能会破坏您对操作系统级别的PHP和MySQL所做的自定义。

  2. MAMP can be easily stopped and thus will only consume system resources when needed.

    MAMP可以很容易地停止,因此只在需要时消耗系统资源。

  3. It is less likely that changes to MAMP will effect any other parts of your system

    对MAMP的更改不太可能影响系统的任何其他部分

  4. You didn't indicate any reason for switching so you are causing yourself unnecessary headache and work just to possibly get back to a point where you already are with MAMP

    你没有指出任何转换的原因,所以你造成了不必要的头痛,并且工作只是为了可能回到你已经和MAMP在一起的地步

I use the Komodo binaries to run XDebug through MAMP. I would recommend doing the same unless there is a reason to install your own through PECL. This post may be relevant to you if you need to access php from the command line.

我使用Komodo二进制文件通过MAMP运行XDebug。我建议做同样的事情,除非有理由通过PECL安装自己的。如果您需要从命令行访问php,这篇文章可能与您有关。