Home > Backend Development > PHP Tutorial > 【php】Mac 默许使用自己安装的php

【php】Mac 默许使用自己安装的php

WBOY
Release: 2016-06-13 12:12:18
Original
1079 people have browsed it

【php】Mac 默认使用自己安装的php

Mac系统自带有PHP,路径为

/usr/bin
Copy after login
由于系统自带的PHP版本一般都比较低,所以我基本不使用系统自带版本,而是自己安装了一个新的版本。

安装的路径是

/usr/local/Cellar/php56/5.6.2
Copy after login
而homebrew在安装完成后自动在
/usr/local/bin
Copy after login
加了个软连接,所以平常都是用这个路径

那我们怎么使用自己安装的PHP呢?

ls -al /usr/local/bin/php
Copy after login
lrwxr-xr-x  1 a2014  admin  29 10 27 23:32 /usr/local/bin/php -> ../Cellar/php56/5.6.2/bin/php
Copy after login


很简单只需调整一下PATH即可:

打开自己SHELL的配置文件

vim ~/.zshrc
Copy after login
将/usr/local/bin的位置放在前面即可

export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template