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

I used MAMP (standard) for PHP Development several times before I read a few posts about embedded Apache / PHP on Snow Leopard . I decided to go to those who were provided with me, but it seems that I have a lot of problems.

First, when I used MAMP, I updated PEAR from 1.9.0 to 1.9.1 (for installing PHPUnit later) with a link to this post . This worked for me with the phpunit team. I also have Xcode4, but it removed it a few weeks ago (I mention this because I don't know what could be causing all my problems).

Then, when I try to use standard Apache and PHP on Snow Leopard, I realize that there are probably two versions of PHP on my Mac.

The first is 5.3.3 when I try to cancel the 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 is 5.3.4, which actually appears when I run the file with phpinfo() or call this command php-config --version . See the screenshot below:

PHP file with phpinfo ()

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

Another problem for me is installing xdebug using PECL . What you can see from the php -i command above is the pre-compiled xdebug.so from Komodo (I read this post ), and not that PECL was installed, since the following errors appear every time I try to install xdebug:

 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 

I donโ€™t know about these riots after a whole day surfing the Internet for them. Please help me sort it out. Please feel free to ask me if you want. Thanks!

- EDIT 1: which php

 ngocminh@MBP [449]:bin$ which php /usr/bin/php 
+4
source share
1 answer

I recommend you stick with MAMP for several reasons.

  • Apple software updates may destroy the settings you made with the OS and PHP versions of PHP and MySQL.

  • MAMP can be easily stopped and therefore will only consume system resources.

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

  • You did not indicate any reason for switching, so you cause an unnecessary headache and work to return to the point where you are already with MAMP

I am using Komodo binaries to run XDebug through MAMP. I would recommend doing the same if there is no reason to install your own through PECL. This message may be relevant for you if you need to access php from the command line.

+1
source

All Articles