参考:https://blog.csdn.net/Phplayers/article/details/100901352

php5.6安装参考:https://www.cnblogs.com/EasonJim/p/9614577.html

注意:记得去掉--enablerepo=remi,直接使用--enablerepo=remi-php56

一、yum 安装 PHP7.3

1、首先安装 EPEL 源:

yum install epel-release -y

# Extra Packages for Enterprise Linux 。EPEL是一个比官方rpm包更丰富、版本相对更高的额外第三方源。
2、安装 REMI 源:

yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y

# 除了EPEL源之外还有REMI的源。它包含最新版本 PHP 和 MySQL 包

3、安装 Yum 源管理工具:

yum install yum-utils -y

# 维护YUM并提高其性能的工具

4、安装php73:

yum --enablerepo=remi-php73 install php -y
# yum --enablerepo=remi-php73 install php73 -y

# yum --enablerepo=[repo]   启用一个或多个软件源(支持通配符)

5、安装常用扩展:

yum --enablerepo=remi-php73 install php-gmp php-zip php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt php-devel php-mysql php-gd php-bcmath php-pdo php-pecl-imagick php-fpm php-curl php-devel php-pear -y

# 卸载命令:yum --enablerepo=remi-php73 remove xxx xxx ..

安装mongodb扩展:

yum --enablerepo=remi-php73 install php-devel php-pear -y
pecl install mongodb

6、开启php:

systemctl start php-fpm

7、加入开机自启动

systemctl enable php-fpm

8、查看php版本:

php -v

二、编译安装 swoole 扩展

1、下载:

https://pecl.php.net/package/swoole下载最新的swoole包。

wget -c https://pecl.php.net/get/swoole-4.4.15.tgz

# git下载地址:https://github.com/swoole/swoole-src

git clone https://github.com/swoole/swoole-src.git

2、解压到指定目录:

tar xf swoole-4.4.15.tgz

3、进入该目录:

cd swoole-4.4.15

4、使用 phpize 生成 configure

/usr/bin/phpize

# phpize 可以直接扩展 php 模块,无需重新编译php

5、编译配置

./configure --enable-openssl --with-php-config=/usr/bin/php-config

# ./configure 后面可以指定的是 php-config 文件的路径,不知道路径可以 find 出来

6、编译 && 安装:

make && make install

7、编译安装成功后,修改php.ini加入:

# vim /etc/php.ini
extension=swoole.so

8、记得重启php-fmp:

systemctl restart php-fpm

9、查看是否启用安装成功:

php --ri swoole

# 注意是否支持ssl


三、安装composer

1、下载安装

php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');"
php composer-setup.php

如果上述方式下载不行,可以尝试下面这种方式:

curl -sS https://getcomposer.org/installer | php

2、移动 composer.phar,这样 composer 就可以进行全局调用:

mv composer.phar /usr/local/bin/composer

3、切换为国内镜像:

# composer config -g repo.packagist composer https://packagist.phpcomposer.com
# 可以切换的镜像源
composer repo:ls -- --------------- ------------------------------------------------
composer https://packagist.org
phpcomposer https://packagist.phpcomposer.com
aliyun https://mirrors.aliyun.com/composer
tencent https://mirrors.cloud.tencent.com/composer
huawei https://mirrors.huaweicloud.com/repository/php
laravel-china https://packagist.laravel-china.org
cnpkg https://php.cnpkg.org
sjtug https://packagist.mirrors.sjtug.sjtu.edu.cn
-- --------------- ------------------------------------------------

4、composer自我更新

composer selfupdate

四、Dockerfile

1、dockerfile-php-fpm-init

# This is my first easyswoole init Dockerfile
# Version 1.0
FROM centos:7
MAINTAINER doublexi "shuangxi.wang@lgitt.com" # 定义swoole版本
ENV SWOOLE_VERSION 4.4.15 RUN yum install epel-release -y \
&& useradd www -M -s /sbin/nologin \
&& yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y \
&& yum install yum-utils -y \
&& yum --enablerepo=remi-php73 install php -y \
&& yum --enablerepo=remi-php73 install php-gmp php-zip php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt php-devel php-mysql php-gd php-bcmath php-pdo php-pecl-imagick php-fpm -y \
&& yum clean all \
&& yum install make -y \
&& curl -fSL https://pecl.php.net/get/swoole-${SWOOLE_VERSION}.tgz -o /opt/swoole-${SWOOLE_VERSION}.tgz \
&& tar xf /opt/swoole-${SWOOLE_VERSION}.tgz -C /opt/ \
&& cd /opt/swoole-${SWOOLE_VERSION} \
&& /usr/bin/phpize \
&& ./configure --enable-openssl --with-php-config=/usr/bin/php-config \
&& make && make install \
&& make clean \
&& php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');" \
&& php composer-setup.php \
&& mv composer.phar /usr/local/bin/composer \
&& composer config -g repo.packagist composer https://mirrors.aliyun.com/composer \
&& cd /opt && rm -rf swoole-${SWOOLE_VERSION}* \
&& echo "set encoding=utf-8" >>/root/.vimrc COPY php.ini /etc/php.ini
COPY php-fpm.conf /etc/php-fpm.conf
COPY www.conf /etc/php-fpm.d/www.conf
COPY localtime /etc/localtime EXPOSE 9000
CMD ["/usr/sbin/php-fpm", "--nodaemonize"]

2、dockerfile-easyswoole-init

# This is my first easyswoole init Dockerfile
# Version 1.0
FROM centos:7
MAINTAINER doublexi "shuangxi.wang@lgitt.com" # 定义swoole版本
ENV SWOOLE_VERSION 4.4.15 RUN yum install epel-release -y \
&& useradd www -M -s /sbin/nologin \
&& yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y \
&& yum install yum-utils -y \
&& yum --enablerepo=remi-php73 install php -y \
&& yum --enablerepo=remi-php73 install php-gmp php-zip php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt php-devel php-mysql php-gd php-bcmath php-pdo php-pecl-imagick php-fpm -y \
&& yum clean all \
&& yum install make -y \
&& curl -fSL https://pecl.php.net/get/swoole-${SWOOLE_VERSION}.tgz -o /opt/swoole-${SWOOLE_VERSION}.tgz \
&& tar xf /opt/swoole-${SWOOLE_VERSION}.tgz -C /opt/ \
&& cd /opt/swoole-${SWOOLE_VERSION} \
&& /usr/bin/phpize \
&& ./configure --enable-openssl --with-php-config=/usr/bin/php-config \
&& make && make install \
&& make clean \
&& php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');" \
&& php composer-setup.php \
&& mv composer.phar /usr/local/bin/composer \
&& composer config -g repo.packagist composer https://mirrors.aliyun.com/composer \
&& cd /opt && rm -rf swoole-${SWOOLE_VERSION}* \
&& echo "set encoding=utf-8" >>/root/.vimrc COPY php.ini /etc/php.ini
COPY php-fpm.conf /etc/php-fpm.conf
COPY www.conf /etc/php-fpm.d/www.conf
COPY localtime /etc/localtime RUN mkdir /opt/easyswoole \
&& cd /opt/easyswoole \
&& composer require easyswoole/easyswoole=3.x \
&& php vendor/easyswoole/easyswoole/bin/easyswoole install \
&& chown -R www.www ./ WORKDIR /opt/easyswoole
EXPOSE 9501
CMD ["php", "easyswoole", "start"]

最新文章

  1. CentOS 7.0 使用 yum 安装 MariaDB 与 MariaDB 的简单配置
  2. 人人都是 DBA(XIII)索引信息收集脚本汇编
  3. IOS开发之Bug--关于C语言数组的容量参数
  4. Sql语句里的递归查询(转)
  5. CISCO VPN出现网关报错
  6. Android用户界面 UI组件--自动提示输入框 AutoCompleteTextView和MultiAutoCompleteTextView
  7. WifiDog and OpenWrt
  8. C# 二维数组和集合
  9. c++类大小问题
  10. (第十三周)Final阶段成员贡献分
  11. sublime text3安装代码格式化的步骤
  12. MVC传参数给js的时候 如果是数值 变量要进行一下转换才能正确识别 例如var aaa = parseInt('@Model.ClickIndex');
  13. XOR and Favorite Number CodeForces - 617E -莫队-异或前缀和
  14. Linux出现wrong ELF class: ELFCLASS64
  15. 【洛谷P1091】合唱队列
  16. Java知多少(80)图形界面设计基础
  17. Tech 2 doesn’t system for H2 above 2007
  18. 利用adb 打开手机应用程序
  19. Python之——生产环境代码包发布管理fabirc
  20. Day05 xml详解

热门文章

  1. simulate_click
  2. JAVA笔记15__TCP服务端、客户端程序 / ECHO程序 /
  3. systemd-nspawn以及container的学习
  4. Git 图形化客户端--Sourcetree
  5. HTML 简单介绍
  6. 【Python+postman接口自动化测试】(4)HTTP 协议
  7. React 三大属性state,props,refs以及组件嵌套的应用
  8. JAVA POI导出EXCEL 动态表头、多级表头、动态数据
  9. 【linux系统】java环境搭建
  10. Android学习—下载Android SDK的两种方式