Two versions of PHP on Mac OS Snow Leopard & Installing xdebug using PECL

ⅰ亾dé卋堺 提交于 2019-12-10 15:19:20

问题


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.

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).

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.

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

    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:

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

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:

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

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

回答1:


I recommend you stick with MAMP for several reasons

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

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

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

  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

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.



来源:https://stackoverflow.com/questions/5789504/two-versions-of-php-on-mac-os-snow-leopard-installing-xdebug-using-pecl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!