美文网首页
mac下配置php环境变量

mac下配置php环境变量

作者: Sugar_ping | 来源:发表于2022-09-20 15:12 被阅读0次

1、Mac系统的环境变量,加载顺序为:

a. /etc/profile

b. /etc/paths

c. ~/.bash_profile

d. ~/.bash_login

e. ~/.profile

f. ~/.bashrc

2、其中a和b是系统级别的,系统启动就会加载,其余是用户接别的。c,d,e按照从前往后的顺序读取,如果c文件存在,则后面的几个文件就会被忽略不读了,以此类推。~/.bashrc没有上述规则,它是bash shell打开的时候载入的。这里建议在c中添加环境变量,以下也是以在c中添加环境变量来演示的。打开Terminal,输入vi ./.bash_profile,回车,打开./.bash_profile文件:

vim .bash_profile 

输入“i”,进入insert模式添加环境变量,例如:export PATH="/Applications/MAMP/bin/php/php7.2.21/bin:$PATH"
编辑完成,点击“esc键,退出insert模式”, 然后输入“:wq!”,回车,保存成功。

3、执行以下命令,让环境变量生效并查看环境变量。

source ./.bash_profile
echo $PATH

4、重新打开终端,环境变量生效。

原文链接:https://blog.csdn.net/weixin_39622084/article/details/115151514

相关文章

网友评论

      本文标题:mac下配置php环境变量

      本文链接:https://www.haomeiwen.com/subject/wyobortx.html