mac 查询php版本信息,升级mac的PHP版本

我今天想安装配置开源项目来学习VUE,但是执行命令的时候,提示我PHP版本过低.

我mac电脑PHP版本是php5.6.2

b1c6461dc6cb74c96c61477c5a3e66d0.png

升级步骤

执行

brew search php

选择安装版本php7.1

brew install php@7.1

5cdfc216ae7a8601bcdb3eb9d00bc6f3.png

==> Caveats

==> apr

apr is keg-only, which means it was not symlinked into /usr/local,

because Apple's CLT package contains apr.

If you need to have apr first in your PATH run:

echo 'export PATH="/usr/local/opt/apr/bin:$PATH"' >> ~/.bash_profile

==> apr-util

apr-util is keg-only, which means it was not symlinked into /usr/local,

because Apple's CLT package contains apr.

If you need to have apr-util first in your PATH run:

echo 'export PATH="/usr/local/opt/apr-util/bin:$PATH"' >> ~/.bash_profile

==> libidn

Emacs Lisp files have been installed to:

/usr/local/share/emacs/site-lisp/libidn

==> openldap

openldap is keg-only, which means it was not symlinked into /usr/local,

because macOS already provides this software and installing another version in

parallel can cause all kinds of trouble.

If you need to have openldap first in your PATH run:

echo 'export PATH="/usr/local/opt/openldap/bin:$PATH"' >> ~/.bash_profile

echo 'export PATH="/usr/local/opt/openldap/sbin:$PATH"' >> ~/.bash_profile

For compilers to find openldap you may need to set:

export LDFLAGS="-L/usr/local/opt/openldap/lib"

export CPPFLAGS="-I/usr/local/opt/openldap/include"

==> curl-openssl

curl-openssl is keg-only, which means it was not symlinked into /usr/local,

because macOS already provides this software and installing another version in

parallel can cause all kinds of trouble.

If you need to have curl-openssl first in your PATH run:

echo 'export PATH="/usr/local/opt/curl-openssl/bin:$PATH"' >> ~/.bash_profile

For compilers to find curl-openssl you may need to set:

export LDFLAGS="-L/usr/local/opt/curl-openssl/lib"

export CPPFLAGS="-I/usr/local/opt/curl-openssl/include"

For pkg-config to find curl-openssl you may need to set:

export PKG_CONFIG_PATH="/usr/local/opt/curl-openssl/lib/pkgconfig"

==> libtool

In order to prevent conflicts with Apple's own libtool we have prepended a "g"

so, you have instead: glibtool and glibtoolize.

==> gettext

gettext is keg-only, which means it was not symlinked into /usr/local,

because macOS provides the BSD gettext library & some software gets confused if both are in the library path.

If you need to have gettext first in your PATH run:

echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.bash_profile

For compilers to find gettext you may need to set:

export LDFLAGS="-L/usr/local/opt/gettext/lib"

export CPPFLAGS="-I/usr/local/opt/gettext/include"

==> libffi

libffi is keg-only, which means it was not symlinked into /usr/local,

because some formulae require a newer version of libffi.

For compilers to find libffi you may need to set:

export LDFLAGS="-L/usr/local/opt/libffi/lib"

For pkg-config to find libffi you may need to set:

export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"

==> sqlite

sqlite is keg-only, which means it was not symlinked into /usr/local,

because macOS provides an older sqlite3.

If you need to have sqlite first in your PATH run:

echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> ~/.bash_profile

For compilers to find sqlite you may need to set:

export LDFLAGS="-L/usr/local/opt/sqlite/lib"

export CPPFLAGS="-I/usr/local/opt/sqlite/include"

For pkg-config to find sqlite you may need to set:

export PKG_CONFIG_PATH="/usr/local/opt/sqlite/lib/pkgconfig"

==> python

Python has been installed as

/usr/local/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to

`python3`, `python3-config`, `pip3` etc., respectively, have been installed into

/usr/local/opt/python/libexec/bin

If you need Homebrew's Python 2.7 run

brew install python@2

You can install Python packages with

pip3 install They will install into the site-package directory

/usr/local/lib/python3.7/site-packages

See: https://docs.brew.sh/Homebrew-and-Python

==> icu4c

icu4c is keg-only, which means it was not symlinked into /usr/local,

because macOS provides libicucore.dylib (but nothing else).

If you need to have icu4c first in your PATH run:

echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.bash_profile

echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.bash_profile

For compilers to find icu4c you may need to set:

export LDFLAGS="-L/usr/local/opt/icu4c/lib"

export CPPFLAGS="-I/usr/local/opt/icu4c/include"

For pkg-config to find icu4c you may need to set:

export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"

==> libpq

libpq is keg-only, which means it was not symlinked into /usr/local,

because conflicts with postgres formula.

If you need to have libpq first in your PATH run:

echo 'export PATH="/usr/local/opt/libpq/bin:$PATH"' >> ~/.bash_profile

For compilers to find libpq you may need to set:

export LDFLAGS="-L/usr/local/opt/libpq/lib"

export CPPFLAGS="-I/usr/local/opt/libpq/include"

For pkg-config to find libpq you may need to set:

export PKG_CONFIG_PATH="/usr/local/opt/libpq/lib/pkgconfig"

==> php@7.1

To enable PHP in Apache add the following to httpd.conf and restart Apache:

LoadModule php7_module /usr/local/opt/php@7.1/lib/httpd/modules/libphp7.so

SetHandler application/x-httpd-php

Finally, check DirectoryIndex includes index.php

DirectoryIndex index.php index.html

The php.ini and php-fpm.ini file can be found in:

/usr/local/etc/php/7.1/

php@7.1 is keg-only, which means it was not symlinked into /usr/local,

because this is an alternate version of another formula.

If you need to have php@7.1 first in your PATH run:

echo 'export PATH="/usr/local/opt/php@7.1/bin:$PATH"' >> ~/.bash_profile

echo 'export PATH="/usr/local/opt/php@7.1/sbin:$PATH"' >> ~/.bash_profile

For compilers to find php@7.1 you may need to set:

export LDFLAGS="-L/usr/local/opt/php@7.1/lib"

export CPPFLAGS="-I/usr/local/opt/php@7.1/include"

To have launchd start php@7.1 now and restart at login:

brew services start php@7.1

Or, if you don't want/need a background service you can just run:

php-fpm

切换版本到php7.1

445ddbacbc928f45507cfa11a50377c5.png

执行

brew link php@7.1

echo 'export PATH="/usr/local/opt/php@7.1/bin:$PATH"' >> ~/.bash_profile

echo 'export PATH="/usr/local/opt/php@7.1/sbin:$PATH"' >> ~/.bash_profile

srouce ~/.bash_profile

执行后查看 ~.bash_profile配置如下

dcfb9e3093eb93cfab5fe056af274254.png

再次查看PHP版本

4152eeff71829a44fe9071c2673d23fa.png

mac下自带apache

需要修改目录/private/etc/apache2/other配置

d0192ad90d7896b87a446c42fb98d4d0.png

967d85d4e4a6d1277dbf89830ff72af6.png

3da47e456d2e8ca818f4bb06db05c04d.png

5509a8a0739e9b53f505f06f6c6c85a1.png

重启apache服务

1a383d245cac2f25c237e5f96598a4f9.png

sudo apachectl restart

项目路径 /Library/WebServer/Documents/index.php

8dc20b47d1a369feb6faa5c56c4824a2.png

浏览器输入localhost

9f175ebe4e971a8be9df31e9f4e3544e.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值