centos7.9 安裝Hyperf 環境

传VV说發表於2024-07-29

安裝php7.4

cat /etc/redhat-release
yum install epel-release
rpm -Uvh https://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install -y yum-utils
yum-config-manager --enable remi-php74
yum install -y php php-fpm php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-redis php-opcache php-devel curl-devel

安裝composer

php -r "readfile('https://getcomposer.org/installer');" | php

mv composer.phar /usr/bin/composer

composer -v

安裝swoole4.8.10擴充套件

pecl install -D 'enable-sockets="no" enable-openssl="yes" enable-http2="yes" enable-mysqlnd="yes" enable-swoole-json="no" enable-swoole-curl="yes" enable-cares="yes"' http://pecl.php.net/get/swoole-4.8.10.tgz

# /etc/php.ini新增擴充套件
extension=swoole.so
# 關閉short name
swoole.use_shortname=Off

安裝swoole常見問題

如果啟用sockets、mysqlnd、swoole-curl時,需要先刪除/etc/php.d/裡面對應的配置20-sockets.ini、20-mysqlnd.ini、20-curl.ini,然後再在/etc/php.ini裡面新增如下配置

extension=curl.so
extension=mysqlnd.so
extension=sockets.so

相關文章