Rumah > Artikel > pembangunan bahagian belakang > 修改 Mac 默认 PHP 运行环境,给 MAMP 配置全局 Composer
<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教程有兴趣的朋友有所帮助。