brew-php-switcher切换PHP版本

20 篇文章 0 订阅

这个brew-php-switch是使用系统自带的Apache配置。

/private/etc/apache2/httpd.conf

一定要注释掉系统自带的,我的是下面的libphp7.so

#LoadModule php7_module libexec/apache2/libphp7.so

官网 https://github.com/philcook/brew-php-switcher

我安装后。使用brew-php-switch xxx (brew-php-switch 5.6)

[bin] brew-php-switcher 5.6                                                                                            
Switching to php@5.6
Switching your shell
Unlinking /usr/local/Cellar/php@5.6/5.6.40... 0 symlinks removed
Unlinking /usr/local/Cellar/php@7.2/7.2.19... 25 symlinks removed
Unlinking /usr/local/Cellar/php/7.3.6... 0 symlinks removed
Linking /usr/local/Cellar/php@5.6/5.6.40... 25 symlinks created

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/usr/local/opt/php@5.6/bin:$PATH"' >> ~/.zshrc
  echo 'export PATH="/usr/local/opt/php@5.6/sbin:$PATH"' >> ~/.zshrc
You will need sudo power from now on
Switching your apache conf
Restarting apache
All done!

显示了重启Apache。不知道为什么刷新页面还是之前的版本。我自己手动 sudo apachectl restart 也是不行 后来我试了下sudo apachectl -k restart 就可以了,所以我想改下源码

sudo vim /usr/local/Cellar/brew-php-switcher/2.1.1/bin/phpswitch.sh (也许你的版本不一样,自己找到这个文件就行)

搜索下 sudo apachectl restart

然后加上-k,再保存,强制保存就行

然后再试一次就行了

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值