4

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:

PHP file with phpinfo()

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

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
Community
  • 1
  • 1
Ngoc Pham
  • 443
  • 5
  • 17
  • Wow this is a mess :p ! Did you remove MAMP ? There is a different PHP, one is CLI (command line), the other CGI (used by apache). It seems here that apache uses a different one than CLI. How did you install PHP on your Mac ? Macports ? Was a PHP included in the Apache server ? – Matthieu Napoli Apr 26 '11 at 11:21
  • I haven't remove MAMP yet because I need it to test my transition to new bundle. PHP (5.3.4 or 5.3.3) was pre-installed on my Mac, I think because I use MAMP 1.9.4 with PHP 5.2.13 & 5.3.2 before. – Ngoc Pham Apr 26 '11 at 11:23
  • And try listing all your PHP installed : `which php` for starter, and try to find all other PHP installed. There is too many PHP on your machine lol. Please answer the other questions too, thanks. – Matthieu Napoli Apr 26 '11 at 11:24
  • Just added `which php` output! – Ngoc Pham Apr 26 '11 at 11:27
  • I might also recommend that you deploy your application to a VM to avoid additional chaos within your OS X install. – Brian Apr 28 '11 at 03:48
  • I also have a Debian server set up on VMWare as a permission-strict environment to test various type of server. It works well without much afford from me, thanks to `apt-get` on Debian. However, Snow Leopard comes with Apache 2.2 and PHP 5.3 by default. That's a good point. I also still develop my apps using local environment. Then I think it's better to have a local set of tools for all my needs. – Ngoc Pham Apr 28 '11 at 05:27

1 Answers1

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.

Community
  • 1
  • 1
John Kramlich
  • 2,220
  • 17
  • 18
  • Thank you John for your answer. I didn't mention the reason why I am running myself into troubles by switching to bundle set from Apple because it sounds silly: I just wanna try :-) However, I think I can't agree with you on some points. 1 - I don't think MAMP consumes less system resouces than default set as I could stop (default) Apache & MySQL server whenever I don't use it using AppleScript and I could triggle it with Alfred instantly. 3 - xdebug (Komodo) is running fine on the system. My question is why I cannot do what others can (throughout their posts) – Ngoc Pham May 03 '11 at 00:19