PHP7 安装 Swoole 教程
swoole  /  管理员 发布于 7年前   237
PHP7 源码安装
步骤
1、解压 tar -xjvf
2、configure
3、make
4、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]# lltotal 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.bz2drwxrwxr-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]# lltotal 8drwxr-xr-x 3 root root 4096 Apr 2 22:04 softdrwxr-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 . ~/.bashrcfi# 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 GroupZend 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
转移 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]# lltotal 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.iniConfiguration 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]# lltotal 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]# lltotal 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.bz2drwxr-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/phpizeConfiguring 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-configchecking how to run the C++ preprocessor... /lib/cppconfigure: error: in `/home/work/study/softpackage/swoole':configure: error: C++ preprocessor "/lib/cpp" fails sanity checkSee `config.log' for more details//说明error: C++ preprocessor "/lib/cpp" fails sanity check 问题的解决 问题的根源是缺少必要的C++库。如果是CentOS系统,运行,如下命令解决: yum install glibc-headers yum install gcc-c++
再执行
[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]# lltotal 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]# lltotal 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:95010.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教程》
以上就是PHP7 安装 Swoole 教程的详细内容,更多请关注其它相关文章!
122 在
学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..123 在
Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..原梓番博客 在
在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..博主 在
佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 @1111老铁这个不行了,可以看看近期评论的其他文章..1111 在
佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 网站不能打开,博主百忙中能否发个APP下载链接,佛跳墙或极光..
Copyright·© 2019 侯体宗版权所有·
粤ICP备20027696号