小編給大家分享一下PHP7源碼安裝swoole的方法,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!
在鐵嶺等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強(qiáng)發(fā)展的系統(tǒng)性、市場前瞻性、產(chǎn)品創(chuàng)新能力,以專注、極致的服務(wù)理念,為客戶提供網(wǎng)站制作、成都網(wǎng)站制作 網(wǎng)站設(shè)計(jì)制作按需規(guī)劃網(wǎng)站,公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),高端網(wǎng)站設(shè)計(jì),成都全網(wǎng)營銷,外貿(mào)網(wǎng)站建設(shè),鐵嶺網(wǎng)站建設(shè)費(fèi)用合理。
解壓tar -xjvf
configure
make
make install
安裝上傳下載命令
yum install -y lrzsz
linux操作
[root@VM_0_5_centos ~]# cd /home/[root@VM_0_5_centos home]# mkdir -p work/study/softpackage[root@VM_0_5_centos softpackage]# pwd/home/work/study/softpackage[root@VM_0_5_centos softpackage]# ll total 14900-rw-r--r-- 1 root root 15235268 Apr 2 21:19 php-7.2.29.tar.bz2[root@VM_0_5_centos softpackage]# tar -xjvf php-7.2.29.tar.bz2 drwxrwxr-x 14 root root 4096 Mar 17 18:16 php-7.2.29-rw-r--r-- 1 root root 15235268 Apr 2 21:19 php-7.2.29.tar.bz2[root@VM_0_5_centos softpackage]# cd php-7.2.29/[root@VM_0_5_centos php-7.2.29]# yum install gcc----configure: error: libxml2 not found. Please check your libxml2 installation.----//start安裝豪華套餐yum -y install gcc libxml2 yum -y install php-mcrypt libmcrypt libmcrypt-devel autoconf freetype gd jpegsrc libmcrypt libpng libpng-devel libjpeg libxml2 libxml2-devel//end[root@VM_0_5_centos php-7.2.29]# ./configure --prefix=/home/work/study/soft/php[root@VM_0_5_centos php-7.2.29]# make[root@VM_0_5_centos php-7.2.29]# make install[root@VM_0_5_centos php-7.2.29]# cd /home/work/study/[root@VM_0_5_centos study]# ll total 8drwxr-xr-x 3 root root 4096 Apr 2 22:04 soft drwxr-xr-x 3 root root 4096 Apr 2 21:44 softpackage[root@VM_0_5_centos study]# cd soft/php/[root@VM_0_5_centos php]# [root@VM_0_5_centos php]# ./bin/php -m//測試[root@VM_0_5_centos php]# vim test.php[root@VM_0_5_centos php]# ./bin/php test.php 1585836467[root@VM_0_5_centos php]# //編輯[root@VM_0_5_centos php]# vi ~/.bash_profile # .bash_profile # Get the aliases and functionsif [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programsPATH=$PATH:$HOME/binexport PATHalias php=/home/work/study/soft/php/bin/php//讓配置生效[root@VM_0_5_centos php]# source ~/.bash_profile [root@VM_0_5_centos php]# php -vPHP 7.2.29 (cli) (built: Apr 2 2020 22:03:18) ( NTS )Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies//測試[root@VM_0_5_centos study]# mkdir demo[root@VM_0_5_centos study]# cd demo/[root@VM_0_5_centos demo]# vim t.php[root@VM_0_5_centos demo]# php t.php1585836787[root@VM_0_5_centos demo]# pwd/home/work/study/demo
轉(zhuǎn)移php.ini
[root@VM_0_5_centos study]# cd softpackage/php-7.2.29/[root@VM_0_5_centos php-7.2.29]# pwd/home/work/study/softpackage/php-7.2.29[root@VM_0_5_centos php-7.2.29]# cp php.ini-development /home/work/study/soft/php/etc/[root@VM_0_5_centos ~]# cd /home/work/study/soft/php/etc/[root@VM_0_5_centos etc]# ll total 80-rw-r--r-- 1 root root 1354 Apr 2 22:05 pear.conf-rw-r--r-- 1 root root 71232 Apr 2 22:17 php.ini-development[root@VM_0_5_centos etc]# mv php.ini-development php.ini[root@VM_0_5_centos php-7.2.29]# php -i | grep php.ini Configuration File (php.ini) Path => /home/work/study/soft/php/lib[root@VM_0_5_centos php-7.2.29]# cd /home/work/study/soft/php/[root@VM_0_5_centos php]# mv ./etc/php.ini ./lib/
上傳swoole文件包
[root@VM_0_5_centos softpackage]# rz[root@VM_0_5_centos softpackage]# ll total 17076drwxrwxr-x 17 root root 4096 Apr 2 21:55 php-7.2.29-rw-r--r-- 1 root root 15235268 Apr 2 21:19 php-7.2.29.tar.bz2-rw-r--r-- 1 root root 2217161 Apr 2 22:27 swoole-swoole-master.zip[root@VM_0_5_centos softpackage]# unzip swoole-swoole-master.zip [root@VM_0_5_centos softpackage]# ll total 17080drwxrwxr-x 17 root root 4096 Apr 2 21:55 php-7.2.29-rw-r--r-- 1 root root 15235268 Apr 2 21:19 php-7.2.29.tar.bz2 drwxr-xr-x 9 root root 4096 Jan 9 20:06 swoole-rw-r--r-- 1 root root 2217161 Apr 2 22:27 swoole-swoole-master.zip//生成configure文件[root@VM_0_5_centos swoole]# /home/work/study/soft/php/bin/phpize Configuring for:PHP Api Version: 20170718Zend Module Api No: 20170718Zend Extension Api No: 320170718[root@VM_0_5_centos swoole]# ./configure --with-php-config=/home/work/study/soft/php/bin/php-config checking how to run the C++ preprocessor... /lib/cpp configure: error: in `/home/work/study/softpackage/swoole': configure: error: C++ preprocessor "/lib/cpp" fails sanity check See `config.log' for more details//說明error: C++ preprocessor "/lib/cpp" fails sanity check 問題的解決 問題的根源是缺少必要的C++庫。如果是CentOS系統(tǒng),運(yùn)行,如下命令解決: yum install glibc-headers yum install gcc-c++
再執(zhí)行
[root@VM_0_5_centos swoole]# ./configure --with-php-config=/home/work/study/soft/php/bin/php-config[root@VM_0_5_centos swoole]# make[root@VM_0_5_centos swoole]# make install[root@VM_0_5_centos swoole]# cd /home/work/study/soft/php/lib/php/extensions/no-debug-non-zts-20170718/[root@VM_0_5_centos no-debug-non-zts-20170718]# ll total 17664-rwxr-xr-x 1 root root 3589814 Apr 2 22:04 opcache.a-rwxr-xr-x 1 root root 1979620 Apr 2 22:04 opcache.so-rwxr-xr-x 1 root root 12488337 Apr 2 22:41 swoole.so[root@VM_0_5_centos lib]# ll total 80drwxr-xr-x 15 root root 4096 Apr 2 22:05 php-rw-r--r-- 1 root root 71232 Apr 2 22:17 php.ini[root@VM_0_5_centos lib]# vi php.ini [root@VM_0_5_centos lib]# pwd/home/work/study/soft/php/lib
在php.ini文件中添加:extension=swoole.so 查看是否添加成功:php -m[root@VM_0_5_centos server]# php echo.php ^C[root@VM_0_5_centos server]# pwd/home/work/study/softpackage/swoole/examples/server//新開窗口[root@VM_0_5_centos server]# netstat -anp|grep 9501tcp 0 0 0.0.0.0:9501 0.0.0.0:* LISTEN 23406/php [root@VM_0_5_centos server]# netstat -anp|grep 9501[root@VM_0_5_centos server]# pwd/home/work/study/softpackage/swoole/examples/server
以上是“PHP7源碼安裝swoole的方法”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
當(dāng)前名稱:PHP7源碼安裝swoole的方法
網(wǎng)頁網(wǎng)址:http://jinyejixie.com/article36/jojpsg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站建設(shè)、動(dòng)態(tài)網(wǎng)站、企業(yè)建站、網(wǎng)站設(shè)計(jì)、網(wǎng)站內(nèi)鏈、定制開發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)