Skip to content

Configure PHP error logging and display on failure #26

Configure PHP error logging and display on failure

Configure PHP error logging and display on failure #26

Workflow file for this run

name: Build and Test PHP Extension
on:
push:
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['8.0', '8.1', '8.3']
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl
- name: Enable core dumps
run: |
ulimit -c unlimited
echo '/tmp/core-%e.%p' | sudo tee /proc/sys/kernel/core_pattern
- name: Set PHP error logging
run: |
echo "error_log = /tmp/php_errors.log" | sudo tee -a /usr/local/etc/php/php.ini
echo "log_errors = On" | sudo tee -a /usr/local/etc/php/php.ini
- name: Install build tools
run: sudo apt-get update && sudo apt-get install -y autoconf automake libtool bison re2c
- name: Prepare build
run: |
phpize
./configure
make
- name: Run tests
run: make test
- name: Run demo
run: |
php -d extension=./modules/rayaop.so -i | grep rayaop
php -d extension=./modules/rayaop.so -d memory_limit=128M -d report_memleaks=1 -d zend.assertions=1 -d assert.exception=1 rayaop.php 2> php_stderr.log
continue-on-error: true
- name: Display PHP error log
run: cat /tmp/php_errors.log
if: failure()
- name: Display stderr output
run: cat php_stderr.log
if: failure()
- name: Check for core dump
run: |
if ls /tmp/core-* 1> /dev/null 2>&1; then
echo "Core dump found"
ls -l /tmp/core-*
else
echo "No core dump found"
fi
if: failure()