[英]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. MAMP Pro使您可以通过应用程序编辑php.ini模板,并在每次启动MAMP Pro时在/Library/Application Support/appsolute/MAMP PRO/conf/php.ini
创建文件。 How do I get it to use this php.ini on the command line? 如何在命令行上使用此php.ini? I have this entry in my .bash_profile
file currently: 我的.bash_profile
文件中当前有此条目:
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版本,但配置文件错误:
$ 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? 我如何才能使其正常工作,以便它使用第一段路径中的php.ini文件? Thanks in advance. 提前致谢。
I suppose MAMP is setting the ini-Path dynamically upon start. 我想MAMP在启动时会动态设置ini-Path。 To get the same behavior on the command line you can pass the ini-path to php via the -c
argument. 要在命令行上获得相同的行为,您可以通过-c
参数将ini-path传递给php。
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
为了更加舒适,您可以将此作为别名添加到.bash_profile
alias php='php -c /Library/Application\ Support/appsolute/MAMP\ PRO/conf/php.ini'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.