MacOS PHP uses Pecl to install the Swoole extension and enable openssl Author: Chuwen Time: 2023-08-26 Classification: PHP ##Install PHP You can refer to this tutorial to install: https://stitcher.io/blog/php-82-upgrade-mac#upgrade -with-shivammathur/homebrew-php In order to save time, I extracted some ```shell brew tap shivammathur/php brew install shivammathur/php/ php@8.2 #Switch to PHP 8.2 brew link --overwrite --force php@8.2 ``` ##Install openssl&get the installation path If you have not installed, you can use this command to install ```shell brew install openssl ``` ! []( https://cdn.nowtime.cc/2023/08/26/4241934229.png ) For example, mine is `/usr/local/Cellar/ openssl@3 /3.1.2 ` Please remember this path ##Install the swoole extension&enable openssl support >Make sure your network environment is normal Execute the following command ```shell sudo pecl install swoole ``` When asked if you want to enable openssl, enter 'yes -- with openssl dir=/usr/local/Cell/ openssl@3 /3.1.2` >Where `/usr/local/Cellar/ openssl@3 /3.1.2 is the installation path of openssl ! []( https://cdn.nowtime.cc/2023/08/26/3703705991.png ) For others, just fill in 'yes' OR' no 'according to your own needs, but note that you may need to specify the path of the relevant library. For details, please see [Official Document ->Compilation Options ->General Parameters]( https://wiki.swoole.com/#/environment?id=%e9%80%9a%e7%94%a8%e5%8f%82%e6%95%b0 "Official Documents") ##Installation complete ! []( https://cdn.nowtime.cc/2023/08/26/3470978648.png ) Check whether the installation is successful. Execute the command 'php -- ri swoole'. If there is content output (as shown in the figure), the installation is successful ! []( https://cdn.nowtime.cc/2023/08/26/3318436440.png ) label: PHP , macOS , brew , Swoole