Skip to content

Better support for Swoole Runtime#191

Merged
Steveb-p merged 2 commits into4.3from
xrow/main
Jan 11, 2023
Merged

Better support for Swoole Runtime#191
Steveb-p merged 2 commits into4.3from
xrow/main

Conversation

@Steveb-p
Copy link
Contributor

@Steveb-p Steveb-p commented Jan 11, 2023

Question Answer
JIRA issue IBX-XXXX
Type improvement
Target Ibexa version v4.2
BC breaks no

Replaces #146 due to lack of response.

SCRIPT_FILENAME is not set in Swoole

You can reproduce it with

export APP_ENV="prod"
export APP_DEBUG="0"
export APP_RUNTIME="Runtime\Swoole\Runtime"
# public/index.php
<?php

use App\Kernel;
$_SERVER['APP_ENV'] = 'dev';
$_SERVER['APP_DEBUG'] = true;

$_SERVER['APP_RUNTIME_OPTIONS'] = [
    'host' => '0.0.0.0',
    'port' => 8080,
    'mode' => SWOOLE_BASE,
    'settings' => [
        \Swoole\Constant::OPTION_WORKER_NUM => swoole_cpu_num() * 2,
        \Swoole\Constant::OPTION_ENABLE_STATIC_HANDLER => true,
        \Swoole\Constant::OPTION_DOCUMENT_ROOT => dirname(__DIR__).'/public'
    ],
];

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';

return function (array $context) {
    return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
};

Checklist:

  • Provided PR description.
  • Tested the solution manually.
  • Provided automated test coverage.
  • Checked that target branch is set correctly (main for features, the oldest supported for bugs).
  • Ran PHP CS Fixer for new PHP code (use $ composer fix-cs).
  • Asked for a review (ping @ibexa/engineering).

@Steveb-p Steveb-p changed the base branch from main to 4.3 January 11, 2023 10:34
@Steveb-p Steveb-p requested a review from alongosz January 11, 2023 10:35
@Steveb-p Steveb-p requested a review from a team January 11, 2023 10:35
@Steveb-p Steveb-p mentioned this pull request Jan 11, 2023
6 tasks
@konradoboza konradoboza requested a review from a team January 11, 2023 10:36
@Steveb-p
Copy link
Contributor Author

@xrow Informing you that this is being merged as you're the original author.

Please do keep in mind that Swoole (and other similar runtimes) remain unsupported, which means that this is done on the "best effort" basis. There might be other issues that might prevent it from working correctly. If there are any, feel free to reach out to me.

@Steveb-p Steveb-p merged commit 6554f05 into 4.3 Jan 11, 2023
@Steveb-p Steveb-p deleted the xrow/main branch January 11, 2023 11:31
@reithor reithor added the Feature New feature request label Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature New feature request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants