Heim > Artikel > Backend-Entwicklung > Ändern Sie die standardmäßige PHP-Laufumgebung auf dem Mac und konfigurieren Sie den globalen Composer für MAMP
<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>
Das Obige stellt vor, wie man die Mac-Standard-PHP-Laufumgebung ändert und den globalen Composer für MAMP konfiguriert, einschließlich der relevanten Inhalte. Ich hoffe, dass es für Freunde hilfreich ist, die an PHP-Tutorials interessiert sind.