记录linux使用dnmp环境

1,docker安装 安装最新的版本

https://cloud.tencent.com/developer/article/1701451

2,docker-composer安装 安装最新版本 (迅雷下载很快)

https://github.com/docker/compose/releases
----下载linux版 :docker-compose-linux-x86_64 (其实是一个可执行文件)

3,使用WinSCP或ftp上传

1重命名= mv docker-compose-linux-x86_64 docker-compose
2添加可执行权限= chmod +x docker-compose
3移动= mv docker-compose /usr/local/bin/
4安装成功= docker-compose -v

4,安装dnmp
4.1安装git

yum install git
文档:https://gitee.com/yeszao/dnmp/tree/master

目录:
记录linux使用dnmp环境_第1张图片
5,安装php8.1以及php8.2

从 \dnmp\services\php80 中复制一份目录到 \dnmp\services 中改名为 php82,然后分别修改以下文件:
\dnmp.env:

#
# PHP8
#
# Available PHP_EXTENSIONS:
#
# pdo_mysql,zip,pcntl,mysqli,mbstring,exif,bcmath,calendar,
# sockets,gettext,shmop,sysvmsg,sysvsem,sysvshm,pdo_rebird,
# pdo_dblib,pdo_oci,pdo_odbc,pdo_pgsql,pgsql,oci8,odbc,dba,
# gd,intl,bz2,soap,xsl,xmlrpc,wddx,curl,readline,snmp,pspell,
# recode,tidy,gmp,imap,ldap,imagick,sqlsrv,mcrypt,opcache,
# redis,memcached,xdebug,swoole,pdo_sqlsrv,sodium,yaf,mysql,
# amqp,mongodb,event,rar,ast,yac,yar,yaconf,msgpack,igbinary,
# seaslog,varnish,xhprof,xlswriter,memcache,rdkafka,zookeeper,
# psr,phalcon,sdebug,ssh2,yaml,protobuf,hprose
#
# You can let it empty to avoid installing any extensions,
# or install multi plugins as:
# PHP_EXTENSIONS=pdo_mysql,mysqli,gd,curl,opcache
#
PHP80_VERSION=8.0.9
PHP80_PHP_CONF_FILE=./services/php80/php.ini
PHP80_FPM_CONF_FILE=./services/php80/php-fpm.conf
PHP80_LOG_DIR=./logs/php80
PHP80_EXTENSIONS=pdo_mysql,mysqli,mbstring,gd,curl,opcache

docker-compose.yml:并将redis #去掉

  php82:
    build:
      context: ./services/php82
      args:
        PHP_VERSION: php:${PHP82_VERSION}-fpm-alpine
        CONTAINER_PACKAGE_URL: ${CONTAINER_PACKAGE_URL}
        PHP_EXTENSIONS: ${PHP82_EXTENSIONS}
        TZ: "$TZ"
    container_name: php82
    expose:
      - 9501
    volumes:
      - ${SOURCE_DIR}:/www/:rw
      - ${PHP82_PHP_CONF_FILE}:/usr/local/etc/php/php.ini:ro
      - ${PHP82_FPM_CONF_FILE}:/usr/local/etc/php-fpm.d/www.conf:rw
      - ${PHP82_LOG_DIR}:/var/log/php
      - ${DATA_DIR}/composer:/tmp/composer
    restart: always
    cap_add:
      - SYS_PTRACE
    networks:
      - default

如果还是像 8.0 的配置一样写 php:${PHP80_VERSION}-fpm-alpine3.13,那么会提示 ERROR [internal] load metadata for docker.io/library/php:8.2.6-fpm-alpine3.13,即使更改最新的 alpine 版本也会报错,因此改为 php:8.2.6-fpm-alpine。
复制过来的 \dnmp\services\php80\extensions,如果已经安装了扩展需要删除已经安装的扩展,保留 install.sh 和 install-php-extensions

nginx配置文件:改成php82
记录linux使用dnmp环境_第2张图片

最后:

docker-compose build php82
docker-compose up

记录linux使用dnmp环境_第3张图片

你可能感兴趣的:(linux,php)