centos7 安装php环境和安装swoole

这仅是我在网上找了多个解决方法,搞定了我遇到的问题,做的一个记录,买这个服务器就是为了测试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.rpm
2 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 

扫描二维码关注公众号,回复: 950149 查看本文章

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

猜你喜欢

转载自www.cnblogs.com/zonglonglong/p/9063240.html
今日推荐