jingjingxyk / swoole-cli

SWOOLE-CLI is a php binary distribution composed swoole & php-core & cli & php-fpm and mostly of common extensions.
10 stars 0 forks source link

容器传入php版本好像没有用? #94

Closed try-to closed 1 year ago

try-to commented 1 year ago
- name: Build
        uses: addnab/docker-run-action@v3
        with:
          image: docker.io/jingjingxyk/build-swoole-cli:all-dependencies-alpine-3.17-php8-v1.0.0-x86_64-20230614T150918Z
          options: -v ${{ github.workspace }}:/work -w /work -e BUILD_PHP_VERSION=8.2.7
          run: |
            bash ./make.sh config
            bash ./make.sh build
            ./php-src/sapi/cli/php -v
            bash ./make.sh archive

编译中下载的依然是8.2.4

 test -d /work/thirdparty/php_src
+ rm -rf /work/thirdparty/php_src
+ make_php_src
build php_src
+ echo 'build php_src'
+ '[' '!' -d /work/thirdparty/php_src ']'
+ mkdir -p /work/thirdparty/php_src
+ tar --strip-components=1 -C /work/thirdparty/php_src -xf /work/pool/lib/php-8.2.4.tar.gz
+ result_code=0
+ '[' 0 -ne 0 ']'
+ cd /work/thirdparty/php_src/

结果

/work/php-src/sapi/cli/php: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=faf6d5d0053d2c64afa43e6c2667e290bd28ad1d, with debug_info, not stripped
ELF Header:
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           Advanced Micro Devices X86-64
  Version:                           0x1
  Entry point address:               0x605180
  Start of program headers:          64 (bytes into file)
  Start of section headers:          128353472 (bytes into file)
  Flags:                             0x0
  Size of this header:               64 (bytes)
  Size of program headers:           56 (bytes)
  Number of program headers:         9
  Size of section headers:           64 (bytes)
  Number of section headers:         31
  Section header string table index: 30
PHP 8.2.4 (cli) (built: Jul 26 2023 06:12:49) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.4, Copyright (c) Zend Technologies
php
/work
jingjingxyk commented 1 year ago

@try-to 指定PHP 版本 https://github.com/jingjingxyk/swoole-cli/blob/build_native_php/docs/options.md


php ./prepare.php --with-php-version=8.1.18

这个配置文件: php ./prepare.php --with-php-version=8.1.18

把 build_native_php 分支设置为主分支,就可以手动选择 PHP 版本,配置选项在这里

默认推送自动构建的PHP版本就是8.2.4 。

想要更改版本 ,如下设置就行


php ./prepare.php --with-php-version=${{ env.BUILD_PHP_VERSION }}
jingjingxyk commented 1 year ago

具体例子:

添加上如下参数

--with-php-version=${{ env.BUILD_PHP_VERSION }}

具体配置


      - name: Prepare
        uses: addnab/docker-run-action@v3
        with:
          image: docker.io/jingjingxyk/build-swoole-cli:all-dependencies-alpine-3.17-php8-v1.0.0-x86_64-20230614T150918Z
          options: -v ${{ github.workspace }}:/work -w /work -e BUILD_PHP_VERSION=${{ env.BUILD_PHP_VERSION }}
          run: |
            set -eux
            # export PATH=/work/bin/runtime:$PATH  # 容器已经内置 php 和 composer 容器

            # composer update --no-dev  --optimize-autoloader
            composer update   --optimize-autoloader

            php prepare.php  +inotify +apcu +ds +xlswriter +ssh2  +pgsql +pdo_pgsql -mongodb --with-swoole-pgsql=1 --with-php-version=${{ env.BUILD_PHP_VERSION }} ${{ inputs.build_type }} ${{ inputs.build_options }} --with-install-library-cached=1 

            chmod a+x make.sh
            head -n 20 make.sh
try-to commented 1 year ago

ok,我试试