Home > other >  Github actions self-hosted cannot setup PHP 7.3
Github actions self-hosted cannot setup PHP 7.3

Time:10-04

I have a deployment.yml file for deploying Laravel Application on a self-hosted ubuntu server via Github actions but unfortunately I ran into this error

==> Setup PHP
✗ PHP Could not setup PHP 7.3
Error: The process '/bin/bash' failed with exit code 1

How can I fix this error?

deployment.yml file

on:
  push:
    branches:
     - master

jobs:
  create-deployment-artifacts:
    name: create deployment artifacts
    runs-on: self-hosted

    steps:
    - uses: actions/checkout@v2

    - name: Configure PHP 7.3
      uses: shivammathur/setup-php@v2
      with:
        php-version: '7.3'
        tools: composer, phpunit
        extensions: mbstring,PDO,grpc,tokenizer,xml,json,ctype,fileinfo,openssl,bcmath

    - name: Install Dependencies
      run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

    - name: Compile Assets
      run: |
         npm install
         npm run prod

    - name: Copy .env
      run: php -r "file_exists('.env') || copy('.env.example', '.env');"

    - name: Generate key
      run: php artisan key:generate

    - name: Directory Permissions
      run: chmod -R 777 storage bootstrap/cache

CodePudding user response:

Please set the environment variable runner as self-hosted on the setup-php step.

Docs: https://github.com/shivammathur/setup-php#self-hosted-setup

- name: Configure PHP 7.3
  uses: shivammathur/setup-php@v2
  env:
    runner: self-hosted
  with:
    php-version: '7.3'
    tools: composer, phpunit
    extensions: mbstring,PDO,grpc,tokenizer,xml,json,ctype,fileinfo,openssl,bcmath

If it still failing, please create an issue here.

  • Related