<codemicrosoft yahei color:rgb white-space:pre-wrap padding:0px border:0px margin-top:-1.2em display:block background:0px> Could not open input file: composer.phar </codemicrosoft>
<codemicrosoft yahei color:rgb white-space:pre-wrap padding:0px border:0px margin-top:-1.2em display:block background:0px> mv composer.phar /usr/local/bin/composer </codemicrosoft>
<codemicrosoft yahei color:rgb white-space:pre-wrap padding:0px border:0px margin-top:-1.2em display:block background:0px> php composer.phar update </codemicrosoft>
<codemicrosoft yahei color:rgb white-space:pre-wrap padding:0px border:0px margin-top:-1.2em display:block background:0px> which php /usr/bin/php </codemicrosoft>
<codemicrosoft yahei color:rgb white-space:pre-wrap padding:0px border:0px margin-top:-1.2em display:block background:0px><span>sudo</span> nano ~/.bash_profile <span># 添加一行。注意 PHP5.4.10 修改成你正在运行的 PHP 版本目录名称</span><span>export</span> PATH=<span>"/Applications/MAMP/bin/php/php5.4.10/bin:<span>$PATH</span>"</span><span># 保存,退出</span><span># 运行一下 .bash_profile 文件</span> . .bash_profile <span># 确认当前正在运行哪个 PHP</span> which php /Applications/MAMP/bin/php/php5.<span>4.10</span>/bin/php </codemicrosoft>
<codemicrosoft yahei color:rgb white-space:pre-wrap padding:0px border:0px margin-top:-1.2em display:block background:0px><span>cd</span> /usr/local/bin curl <span>-s</span>S https://getcomposer.org/installer | php Composer successfully installed to: /usr/local/bin/composer.phar Use it: php composer.phar <span># 修改一下 composer.phar 文件的权限</span><span>sudo</span> chmod a+x composer.phar </codemicrosoft>
<codemicrosoft yahei color:rgb white-space:pre-wrap padding:0px border:0px margin-top:-1.2em display:block background:0px><span>cd</span> /my/project/path <span># 注意此时 composer.phar 命令前面已经不需要加 php 了</span> composer.phar create-project composer.phar self-update composer.phar install composer.phar update </codemicrosoft>
이상에서는 Mac에서 기본 PHP 실행 환경을 수정하는 방법과 MAMP용 글로벌 Composer를 구성하는 방법을 관련 내용을 포함하여 소개했습니다. PHP 튜토리얼에 관심이 있는 친구들에게 도움이 되길 바랍니다.