如何升级MacOS自带的PHP到指定版本(5.3-7.3)

参考链接:https://php-osx.liip.ch/

One Line Installation(一行安装)

你所需要做的,只是打开一个shell窗口(terminal),然后根据版本输入以下命令:
(更新于2018-11-14)

PHP 7.3 (Next stable) - 10.10 and later

curl -s https://php-osx.liip.ch/install.sh | bash -s 7.3

PHP 7.2 (Current stable) - 10.10 and later

curl -s https://php-osx.liip.ch/install.sh | bash -s 7.2

PHP 7.1 (Old stable) - 10.10 and later

curl -s https://php-osx.liip.ch/install.sh | bash -s 7.1

PHP 7.0 (Old stable) - 10.10 and later

curl -s https://php-osx.liip.ch/install.sh | bash -s 7.0

PHP 5.6 (Old stable) - 10.8 and later

curl -s https://php-osx.liip.ch/install.sh | bash -s 5.6

PHP 5.5 (End of life) - All OS X versions

curl -s https://php-osx.liip.ch/install.sh | bash -s 5.5

PHP 5.4 (End of life) - All OS X versions

curl -s https://php-osx.liip.ch/install.sh | bash -s 5.4

PHP 5.3 (End of life) - All OS X versions

curl -s https://php-osx.liip.ch/install.sh | bash -s 5.3

我们会把包安装到/usr/local/packer下,然后PHP会安装到/usr/local/php5

FAQ

问什么使用php -v命令会显示旧版本的信息?

php-osx不会覆盖到Mac自带的PHP binaries上,但是会安装到/usr/local/php5上,新的binary包会装在 /usr/local/php5/bin/php上。
不过你可以设置PATH,修改~/.profile:
export PATH=/usr/local/php5/bin:$PATH

为什么时区不对?为什么我的配置文件不生效?

参见/usr/local/php5/php.d/99-liip-developer.ini

你可能感兴趣的:(PHP,还没写好)