Skip to content

Commit

Permalink
Merge pull request #178 from joanhey/ini_entries
Browse files Browse the repository at this point in the history
Working with PHP 8.3
  • Loading branch information
rryqszq4 authored Dec 3, 2023
2 parents 2c16e98 + 6480605 commit 256fc74
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 46 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ env:
jobs:
build_php_22-04:
name: Compile PHP Ubuntu 22.04
if: ${{ contains(github.event.head_commit.message, '<compile') }}
uses: ./.github/workflows/build_22.04_compile_php.yml
if: ${{ !contains(github.event.head_commit.message, '<compile') }}
uses: ./.github/workflows/build_22.04.yml

build_20-04:
name: Ubuntu 20.04
Expand All @@ -38,6 +38,6 @@ jobs:

build_dynamic_22-04:
name: Ubuntu 22.04 dynamic
if: ${{ !contains(github.event.head_commit.message, '<22') }}
if: ${{ contains(github.event.head_commit.message, '<22') }}
uses: ./.github/workflows/build_22.04_dynamic.yml

2 changes: 1 addition & 1 deletion .github/workflows/build_20.04.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

strategy:
matrix:
php_version: ["7.0", "7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2"]
php_version: ["7.0", "7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3"]
ngxinx_version: ["1.20.2", "1.22.1", "1.24.0"] # "1.12.2" fail to compile
# Disable fail-fast to allow all failing versions to fail in a
# single build, rather than stopping when the first one fails.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_20.04_dynamic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

strategy:
matrix:
php_version: ["7.0", "7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2"]
php_version: ["7.0", "7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3"]
ngxinx_version: ["1.20.2", "1.22.1", "1.24.0"] # "1.12.2" fail to compile
# Disable fail-fast to allow all failing versions to fail in a
# single build, rather than stopping when the first one fails.
Expand Down
70 changes: 70 additions & 0 deletions .github/workflows/build_22.04.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: 22.04 Ngx-php & PHP build test

on:
workflow_call:

env:
DB_DATABASE: ngx_php
DB_USER: ngx_php
DB_PASSWORD: ngx_php

jobs:
build:
runs-on: ubuntu-22.04

strategy:
matrix:
php_version: ["7.0", "7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3"]
ngxinx_version: ["1.20.2", "1.22.1", "1.24.0"] # "1.12.2" fail to compile
# Disable fail-fast to allow all failing versions to fail in a
# single build, rather than stopping when the first one fails.
fail-fast: false

name: PHP-${{ matrix.php_version }} Nginx ${{ matrix.ngxinx_version }}

steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: sudo apt-get install -yqq cpanminus libxml2-dev systemtap-sdt-dev zlib1g-dev libpcre3-dev libargon2-0-dev libsodium-dev

- name: Setup PHP-${{ matrix.php_version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php_version }}
extensions: dev, embed, opcache, mysql
ini-values: opcache.enable=1, opcache.enable_cli=1, opcache.jit=tracing, opcache.jit_buffer_size=128M,error_reporting=E_ALL
coverage: none

- name: Download Nginx v${{ matrix.ngxinx_version }}
run: |
wget http://nginx.org/download/nginx-${{ matrix.ngxinx_version }}.tar.gz
tar -zxf nginx-${{ matrix.ngxinx_version }}.tar.gz
- name: Compile Ngx-php
env:
PHP_SRC_VERSION: ${{ matrix.php_version }}
NGINX_SRC_VERSION: ${{ matrix.ngxinx_version }}
run: ./.github/ngx-php/compile-ngx.sh

- name: MySQL Start and create table
run: |
sudo systemctl start mysql.service
mysql -uroot -proot -e 'CREATE DATABASE ${{ env.DB_DATABASE }};'
mysql -uroot -proot < .github/ngx-php/world.sql
- name: Install Redis & Memcached
run: |
sudo apt-get install -y redis-server redis-tools memcached
sudo redis-server /etc/redis/redis.conf
- name: Perl packages
run: sudo cpanm -n Test::Nginx

- name: Test
env:
PHP_SRC_VERSION: ${{ matrix.php_version }}
run: |
sudo cp .github/ngx-php/php/99-xdebug.ini /etc/php/${PHP_SRC_VERSION}/embed/conf.d/
sudo cp .github/ngx-php/php/99-xdebug.ini /etc/php/${PHP_SRC_VERSION}/cli/conf.d/
sudo sed -i "s|opcache.jit=off|opcache.jit=tracing|g" /etc/php/${PHP_SRC_VERSION}/embed/conf.d/10-opcache.ini
./.github/ngx-php/test.sh
39 changes: 0 additions & 39 deletions .github/workflows/build_22.04_compile_php.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/build_22.04_dynamic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

strategy:
matrix:
php_version: ["7.4", "8.0", "8.1", "8.2"] # "7.0", "7.1", "7.2", "7.3",
php_version: ["7.4", "8.0", "8.1", "8.2", "8.3"] # "7.0", "7.1", "7.2", "7.3",
ngxinx_version: ["1.20.2", "1.22.1", "1.24.0"] # "1.12.2" fail to compile
# Disable fail-fast to allow all failing versions to fail in a
# single build, rather than stopping when the first one fails.
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build_development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- development
- next
paths:
- "src/**"
- "t/**"
Expand Down
10 changes: 9 additions & 1 deletion src/php/impl/php_ngx.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ static void php_ngx_register_variables(zval *track_vars_array )
}*/

sapi_module_struct php_ngx_module = {
#if (PHP_MAJOR_VERSION >= 8 && PHP_MINOR_VERSION > 2)
#if (PHP_MAJOR_VERSION >= 8 && PHP_MINOR_VERSION > 2)
"ngx-php",
#else
"cli-server", /* name */
Expand Down Expand Up @@ -424,8 +424,12 @@ int php_ngx_module_init()
setmode(_fileno(stderr), O_BINARY); /* make the stdio mode be binary */
#endif

#if (PHP_MAJOR_VERSION >= 8 && PHP_MINOR_VERSION > 2)
php_ngx_module.ini_entries = HARDCODED_INI;
#else
php_ngx_module.ini_entries = malloc(sizeof(HARDCODED_INI));
memcpy(php_ngx_module.ini_entries, HARDCODED_INI, sizeof(HARDCODED_INI));
#endif

php_ngx_module.additional_functions = additional_functions;

Expand Down Expand Up @@ -466,8 +470,12 @@ void php_ngx_module_shutdown()
#ifdef ZTS
tsrm_shutdown();
#endif

#if (PHP_MAJOR_VERSION <= 8 && PHP_MINOR_VERSION <= 2)
if (php_ngx_module.ini_entries){
free(php_ngx_module.ini_entries);
php_ngx_module.ini_entries = NULL;
}
#endif

}

0 comments on commit 256fc74

Please sign in to comment.