Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for 32 bit builds of PHP #302

Closed
danog opened this issue Oct 6, 2020 · 4 comments
Closed

Support for 32 bit builds of PHP #302

danog opened this issue Oct 6, 2020 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@danog
Copy link

danog commented Oct 6, 2020

Describe the feature
Thanks for the awesome project!
It would be great if you could also specify the architecture of binaries about to be installed, I would like to run my tests on 32-bit versions of PHP, too.

@danog danog added the enhancement New feature or request label Oct 6, 2020
@shivammathur
Copy link
Owner

shivammathur commented Oct 8, 2020

By default 64 bit PHP is installed, except on Windows for PHP 5.6 and below which is 32 bit.

I have no plans to adding cross-platform support for specifying the architecture directly as an input unless someone sponsors this work.
But on Ubuntu for PHP 5.6 to 7.4, you can use shivammathur/node docker images as a container and run setup-php manually to get both 32 bit and 64 bit PHP.

Here is a test workflow.

name: Multiarch workflow
on:
  push:
jobs:
  run:
    runs-on: ubuntu-latest
    container: shivammathur/node:latest-${{ matrix.arch }}
    strategy:
      matrix:
        arch: ["amd64", "i386"]
    steps:
      - name: Install PHP
        run: |
          # Update spc (See https://github.com/shivammathur/spc for options)
          spc -U

          # Install PHP
          spc --php-version "7.4" \
              --extensions "mbstring, intl" \
              --ini-values "post_max_size=256M, short_open_tag=On" \
              --coverage "xdebug" \
              --tools "php-cs-fixer, phpunit"
      - name: check int size
        # PHP_INT_SIZE is 4 for 32 bit and 8 for 64 bit
        run: php -r "echo PHP_INT_SIZE;"

@danog
Copy link
Author

danog commented Oct 8, 2020

Thanks!

@danon
Copy link

danon commented Aug 21, 2021

By default 64 bit PHP is installed, except on Windows for PHP 5.6 and below which is 32 bit.

I have no plans to adding cross-platform support for specifying the architecture directly as an input unless someone sponsors this work.
But on Ubuntu for PHP 5.6 to 7.4, you can use shivammathur/node docker images as a container and run setup-php manually to get both 32 bit and 64 bit PHP.

Here is a test workflow.

name: Multiarch workflow
on:
  push:
jobs:
  run:
    runs-on: ubuntu-latest
    container: shivammathur/node:latest-${{ matrix.arch }}
    strategy:
      matrix:
        arch: ["amd64", "i386"]
    steps:
      - name: Install PHP
        run: |
          # Update spc (See https://github.com/shivammathur/spc for options)
          spc -U

          # Install PHP
          spc --php-version "7.4" \
              --extensions "mbstring, intl" \
              --ini-values "post_max_size=256M, short_open_tag=On" \
              --coverage "xdebug" \
              --tools "php-cs-fixer, phpunit"
      - name: check int size
        # PHP_INT_SIZE is 4 for 32 bit and 8 for 64 bit
        run: php -r "echo PHP_INT_SIZE;"

i can't get it working.

I can't use actions/checkout and I can't install git to clone the repo. How to make it work?

@shivammathur
Copy link
Owner

@danon
I have fixed this in our shivammathur/node x86 images (shivammathur/node-docker@ac95d44) and now actions should work using the normal syntax on them (spc is not required anymore). I will update the documentation about this in the next release.

Test workflow: https://github.com/shivammathur/test-setup-php/actions/runs/1154928977/workflow

name: Multiarch workflow
on:
  push:
jobs:
  run:
    runs-on: ubuntu-latest
    container: 
      image: shivammathur/node:latest-${{ matrix.arch }}
    strategy:
      matrix:
        arch: ["amd64", "i386"]
    steps:
      - uses: actions/checkout@v2    
      - name: Install PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: 8.0
          extensions: mbstring, intl
          ini-values: post_max_size=256M, short_open_tag=On
          coverage: xdebug
          tools: php-cs-fixer, phpunit
      - name: check int size
        # PHP_INT_SIZE is 4 for 32 bit and 8 for 64 bit
        run: php -r "echo PHP_INT_SIZE;"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants