change the PHP path to MAMPs PHP

后端 未结 6 856
野的像风
野的像风 2020-12-05 08:38

I\'m running PHP with MAMP on OSX 10.5.8

So if I want to run a script from console I always need to write

/applications/mamp/bin/php5.3/bin/php path/         


        
6条回答
  •  醉话见心
    2020-12-05 09:28

    Use latest MAMP version of PHP

    you need to edit .bash_profile

    open -a TextEdit ~/.bash_profile
    

    if you cannot find bash_profile under your home directory then create .bash_profile:

     touch ~/.bash_profile
    

    Use latest MAMP version of PHP

    PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1`
    export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH
    

    (Use source ~/.bash_profile after making your changes to make sure they take effect.)

    source: How to override the path of PHP to use the MAMP path?

提交回复
热议问题