PHP安裝swoole擴充套件

2021-09-25 22:27:44 字數 1801 閱讀 9651

個人伺服器進行swoole安裝  伺服器 centos 6.8版本 

swoole手冊建議pecl安裝

pecl install swoole
執行這個命令之後發現沒有pecl這個命令

所以只能進行pecl安裝

yum install php71w-pear php71w-devel
php71w這個是因為php版本原因 根據個人環境修改

然後就可以執行上限的swoole命令了

進行編譯卻出現了錯誤  進行解讀後發現是gcc版本不夠 要求gcc版本4.8及以上  只能進行gcc版本公升級

網上找了很多gcc公升級教程  很多都是進行編譯的  但是編譯總是出現錯誤最後找到了解決辦法

# curl -lks  > /etc/yum.repos.d/hop5.repo

# yum install gcc gcc-g++ -y

# gcc --version

執行這三條命令就可以進行gcc公升級了

公升級之後再執行

pecl install swoole
之後就正確安裝了

然後在php.ini中加入

extension=swoole.so
之後使用

php -m
就可以檢視到swoole擴充套件已經安裝了

常見提示錯誤:

php warning:  php startup: unable to load dynamic library '/usr/lib64/php/modules/swoole.so' - /usr/lib64/php/modules/swoole.so: undefined symbol: mysqlnd_find_charset_nr in unknown on line 0

需要安裝mysqlnd的php模組,yum install php71w-mysqlnd模組,又報錯:

loaded plugins: fastestmirror

setting up install process

loading mirror speeds from cached hostfile

* webtatic: us-east.repo.webtatic.com

resolving dependencies

--> running transaction check

---> package php71w-mysqlnd.x86_64 0:7.1.30-1.w6 will be installed

--> processing conflict: php71w-mysql-7.1.30-1.w6.x86_64 conflicts php71w-mysqlnd

--> finished dependency resolution

error: php71w-mysql conflicts with php71w-mysqlnd-7.1.30-1.w6.x86_64

you could try using --skip-broken to work around the problem

you could try running: rpm -va --nofiles --nodigest

這個是php71w-myql 和php71w-mysqlnd只能安裝乙個。

1。yum remove php71w-mysql

2。yum install php71w-mysqlnd

然後重啟php-fpm 即可!

php 安裝swoole擴充套件

2 解壓unzip swoole src master.zip 3 編譯發現沒有configure 使用phpize 生成 configure 進入到swoole 解壓後的目錄 cd usr local src swoole src master 執行phpize usr local php7 bi...

php安裝swoole擴充套件

pecl download swoole解壓並進入目錄 tar zxvf swoole 4.3.3.tar.gz cd swoole 4.3.3執行phpize生成configure可執行檔案 這裡的目錄一定是你要安裝swoole擴充套件對應的php版本的安裝目錄,如果存在多個php版本一定要注意這...

php擴充套件swoole的安裝

前提條件 事先已經安裝好了php,版本建議在php7或是以上 2.解壓安裝 tar zxvf swoole src 4.2.9.tar.gz cd swoole src 4.2.9 phpize ubuntu 沒有安裝phpize可執行命令 sudo apt get install php dev來...