Two versions of PHP on Mac OS Snow Leopard and install xdebug using PECL

Before I read some posts about Snow Leopard’s built-in Apache/PHP, I used MAMP (standard) for PHP development. I decided to turn to the ones I provided, but there seemed to be many problems

The first thing is when I use MAMP, I upgrade PEAR from 1.9.0 to 1.9.1 (install PHPUnit later), quoted from this post. Use the phpunit command to It works well for me. I also have Xcode4, but deleted it a few weeks ago (I mention this because I don’t know what is causing all my troubles).

Then, when I tried to use the default Apache and PHP on Snow Leopard, I realized that there might be two versions of PHP on my Mac.

When I tried to undo the php -i command, the first One is 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, which is actually displayed when I run the file with phpinfo() or call the php-config –version command. Please see the screenshot below:

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

Another problem for me is to install xdebug using PECL. From the php -i command above, we can see that it is from Komodo The pre-compiled xdebug.so (I read this post), instead of the PECL installation content whenever I try to install xdebug, these errors will 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

After going online for them all day, I don’t know the confusion. Please help me figure it out. If If you are willing, please do not hesitate to ask me for more details. Thank you! ! !

–EDIT 1: Which php

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

pre>
I suggest you stick to MAMP for several reasons

>From Apple's software updates may break the customizations you have made to PHP and MySQL at the operating system level.
> MAMP can be easily stopped, so system resources are only consumed when needed.
>The changes to MAMP are not too great May affect any other part of the system
>You did not point out any reason for the conversion, so you have caused unnecessary headaches, and work just to possibly return to the point where you are already with MAMP

I use Komodo binaries to run XDebug via MAMP. I suggest you do the same thing unless there is a reason to install your own via PECL. This post may be relevant to you if you need to access PHP from the command line.

< /div>

Before I read some posts about Snow Leopard's built-in Apache/PHP, I used to use MAMP (standard) for PHP development. I decided to turn to the ones I provided, but there seemed to be a lot of problems.

The first thing is that when I use MAMP, I upgrade PEAR from 1.9.0 to 1.9.1 (install PHPUnit later), quoted from this post. Use the phpunit command to me It works well. I also have Xcode4, but deleted it a few weeks ago (I mention this because I don’t know what is causing all my troubles).

Then , When I tried to use the default Apache and PHP on Snow Leopard, I realized that there might be two versions of PHP on my Mac.

When I tried to undo the php -i command, the first One is 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 is 5.3.4, when I run the file with phpinfo() or call the php-config --version command Actual display. Please see the screenshot below:

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

For me Another problem is to install xdebug using PECL. What you can see from the php -i command above is the pre-compiled xdebug.so from Komodo (I have read this post), not what PECL installs whenever I try to install xdebug , These errors will 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< br />Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Exte nsion Api No:
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

ERROR: `phpize' failed

After being online for them all day, I don’t know about the confusion. Please help me figure it out. If you want, please don’t hesitate to ask me for more details. Thank you! ! !

–EDIT 1: Which php

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

pre>

I suggest you stick to MAMP for several reasons

>Software updates from Apple may destroy your level of operating system Customizations made by PHP and MySQL.
>MAMP can be easily stopped, so system resources are only consumed when needed.
>Changes to MAMP are unlikely to affect any other part of the system
>you Did not point out any reason for the conversion, so you have caused unnecessary headaches, and the work is just to possibly return to the point where you are already with MAMP

I use Komodo binary files to run XDebug through MAMP. I recommend You do the same thing unless there is a reason to install your own via PECL. This post may be relevant to you if you need to access PHP from the command line.

Leave a Comment

Your email address will not be published.