0
votes

I'm trying to set up a PHP development environment on my Mac (lion) and I'm having a hard time installing pear , phpunit, and xdebug because I think I have multiple versions of PHP running on my computer.

When I'm in the command line and I type php -i

I get Xdebug installed: 2.1.2
Server API: Command Line Interface
Windows: no
Zend Server: no
PHP Version: 5.3.8
Zend API nr: 220090626
PHP API nr: 20090626
Debug Build: no
Thread Safe Build: no
Configuration File Path: /etc
Configuration File: /private/etc/php.ini
Extensions directory: /usr/lib/php/extensions/no-debug-non-zts-20090626

But when I enable Web Sharing in preferences, create a file with
then navigate to that in my browser like: localhost/phpinfo.php

I get these settings:

Xdebug installed: no
Server API: Apache 2.0 Handler
Windows: no
Zend Server: no
PHP Version: 5.4.0
Zend API nr: 220100525
PHP API nr: 20100525
Debug Build: no
Thread Safe Build: no
Configuration File Path: /usr/local/php5/lib
Configuration File: /usr/local/php5/lib/php.ini
Extensions directory:

As you can see, I have two different configuration files... What is going on here? I need to be able to install phpunit and this is giving me lots of trouble!

1

1 Answers

3
votes

That's normal. PHP keeps two copies of the .ini files, because command-line operation is significantly different from web-based usage. Things like max execution time, memory limits, various web-specific config options, etc... are disabled/maxed-out when running in CLI mode.

I would be concerned about the two different PHP versions, however. You've got 5.3.8 for command line and 5.4.0 for web-based. That means you've got two completely independent installs of PHP. The cli version would seem to be a one-off, since it's looking /private, and not the usual /usr/local directories for config/ini info.