分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 运营维护

centos7 安装php环境和安装swoole

发布时间:2023-09-06 01:55责任编辑:郭大石关键词:暂无标签

这仅是我在网上找了多个解决方法,搞定了我遇到的问题,做的一个记录,买这个服务器就是为了测试swoole,结果快到期了,swoole还没装好

感谢https://www.cnblogs.com/phpwechat/p/8417331.html 

https://www.cnblogs.com/zakun/p/5840073.html

https://blog.csdn.net/malinjie66/article/details/52175132

安装httpd(就是apache)

1.安装
yum -y install httpd
2.开启apache服务
systemctl start httpd.service
3.设置apache服务开机启动
systemctl enable httpd.service

安装php 

CentOS/RHEL 7.x:

1 rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm2 rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

CentOS/RHEL 6.x:

 1 rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm 

2 rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm 

yum安装php7.0:(拓展自选)

 1 yum install php70w-common php70w-fpm php70w-opcache php70w-gd php70w-mysqlnd php70w-mbstring php70w-pecl-memcached php70w-devel 

以上命令安装了下面的拓展!

php-api, php-bz2, php-calendar, php-ctype, php-curl, php-date, php-exif, php-fileinfo, php-filter, php-ftp, php-gettext, php-gmp, php-hash, php-iconv, php-json, php-libxml, php-openssl, php-pcre, php-pecl-Fileinfo, php-pecl-phar, php-pecl-zip, php-reflection, php-session, php-shmop, php-simplexml, php-sockets, php-spl, php-tokenizer, php-zend-abi, php-zip, php-zlib


安装完后,可以先写个index.php测试一下,我的网站目录是在根目录的var/www/html/下面写php或html即可

如果写的html可以浏览器访问,但是php直接把源码显示出来了,网上说是因为apache没有安装或关联php模块

使用这个命令yum install mod_php71w(https://blog.csdn.net/joker_daddy/article/details/79180963)

这样显示源码的问题就ok了

 安装swool

pecl install swoole

安装可选参数默认 NO

enable debug/trace log support?enable sockets supports?enable openssl support?enable http2 support?enable async-redis support? enable mysqlnd support?enable postgresql coroutine client support?




然后修改php.ini
增加
extension=swoole.so
然后重启httpd(systemctl restart httpd.service)

检查
php -m | grep swoole
如果有显示说明安装好了


安装mysql去网上查吧
至于测试swoole前往 ?https://wiki.swoole.com/wiki/page/p-quickstart.html

centos7 安装php环境和安装swoole

原文地址:https://www.cnblogs.com/zonglonglong/p/9063240.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved