Vincent
Vincent

Reputation: 374

Set PHP path correctly for MAMP Pro

MAMP Pro makes you edit a php.ini template through the application and it creates the file in /Library/Application Support/appsolute/MAMP PRO/conf/php.ini each time MAMP Pro is started. How do I get it to use this php.ini on the command line? I have this entry in my .bash_profile file currently:

export PATH=/Applications/MAMP/bin/php/php5.4.4/bin:/Applications/MAMP/Library/bin:$PATH

This shows the correct PHP version at the command line, but the wrong config file:

$ php -i | grep php\.ini
Configuration File (php.ini) Path => /Applications/MAMP/bin/php/php5.4.4/conf
Loaded Configuration File => /Applications/MAMP/bin/php/php5.4.4/conf/php.ini
$ php --version
PHP 5.4.4 (cli) (built: Jul  4 2012 17:28:56) 

How can I get this to work so that it uses the php.ini file from the path in the first paragraph? Thanks in advance.

Upvotes: 0

Views: 1629

Answers (1)

Max
Max

Reputation: 1525

I suppose MAMP is setting the ini-Path dynamically upon start. To get the same behavior on the command line you can pass the ini-path to php via the -c argument.

php -c /Library/Application\ Support/appsolute/MAMP\ PRO/conf/php.ini

For more comfort you could add this as an alias to your .bash_profile

alias php='php -c /Library/Application\ Support/appsolute/MAMP\ PRO/conf/php.ini'

Upvotes: 3

Related Questions