[email protected] install php7.4...">

当前位置:网站首页>Mac PHP multi version management and swoole extension installation

Mac PHP multi version management and swoole extension installation

2022-06-25 16:40:00 Death-Satan

mac Many versions php management

Tools needed

  • brew-php-switcher

install php

install php8.1


brew install shivammathur/php/[email protected]

install php7.4


brew install shivammathur/php/[email protected]

install brew-php-switcher


brew install brew-php-switcher

Command line multi version switching


brew-php-switcher 7.4 # Switch to 7.4
brew-php-switcher 8.0 # Switch to 8.1

I'm not sure why brew-php-switcher Provided only To 8.0 Version switching
But actually when I switch here , Appoint 8.0 Will switch to the 8.1, Maybe it's because I don't have 8.0 Code for

Install the extension

After switching versions, you can directly use pecl Command installation extends , For example, I want to php8.1 install swoole


brew-php-switcher 8.1 # Switch to 8.1
# Pay attention to opening a new one directly shell window , Because the current active window after switching is completed php The version has not changed 
pecl install -D -D 'enable-sockets="no" enable-openssl="yes --with-openssl-dir=/usr/local/opt/openssl" enable-http2="yes" enable-mysqlnd="yes" enable-swoole-json="no" enable-swoole-curl="yes" enable-cares="yes"'

Wait for the command to be installed successfully php -m | grep

 Insert picture description here
ok

原网站

版权声明
本文为[Death-Satan]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/176/202206251601120263.html