Skip to content

Conversation

@ArtKoKo
Copy link

@ArtKoKo ArtKoKo commented Nov 20, 2025

Summary

This PR includes two changes:

  1. php-openswoole (new port): High-performance network framework for PHP

    • Supports PHP 8.0 through 8.4
    • Version 25.2.0 for PHP 8.2+
    • Version 22.1.2 for PHP 8.1
    • Version 4.11.1 for PHP 8.0
    • Fork of Swoole with additional features
    • Properly declares conflicts with php-swoole
  2. php-swoole (existing port): No changes, maintained for reference

Testing

  • Portfile syntax validated with port lint
  • Checksums verified for all versions
  • Conflicts properly declared between swoole and openswoole
  • Dependencies verified

Notes

  • OpenSwoole must load after the sockets extension (handled via php.extension_ini)
  • Both extensions cannot be installed simultaneously (mutual conflicts)
  • OpenSwoole includes additional features: brotli and c-ares (v22.0.0+)
Type(s)
  • bugfix
  • enhancement
  • security fix
Tested on

macOS 15.7.2 24G325 arm64
Command Line Tools 26.1.0.0.1.1761104275

Verification

Have you

  • followed our Commit Message Guidelines?
  • squashed and minimized your commits?
  • checked that there aren't other open pull requests for the same change?
  • referenced existing tickets on Trac with full URL in commit message?
  • checked your Portfile with port lint?
  • tried existing tests with sudo port test?
  • tried a full install with sudo port -vst install?
  • tested basic functionality of all binary files?
  • checked that the Portfile's most important variants haven't been broken?

    - php-swoole: maintained existing version branches
    - php-openswoole: add new port with support for PHP 8.0-8.4
    - php-openswoole: version 25.2.0 for PHP 8.2+
    - php-openswoole: version 22.1.2 for PHP 8.1
    - php-openswoole: version 4.11.1 for PHP 8.0
    - both ports have mutual conflicts declared
@macportsbot
Copy link

Notifying maintainers:
@ryandesign for port php-openswoole, php-swoole.

@BjarneDMat
Copy link
Contributor

duplicate of work in #28140

@ArtKoKo
Copy link
Author

ArtKoKo commented Nov 21, 2025

Not really, the same work for openswoole with the dependencies...

BjarneDMat pushed a commit to BjarneDMat/macports-ports that referenced this pull request Nov 22, 2025
@BjarneDMat
Copy link
Contributor

So, I implemented your work in my PR28140
I've got the following Questions/Issues:

  1. Why have you dropped support for php7x ? I know, that @ryandesign will want to keep it
  2. Why version 4.11.1 for php80 instead of 22.0.0 ?

I've tested on my platforms :

Model Identifier: Macmini6,1                Model Identifier: MacPro5,1
macOS 10.15.7 19H2026 x86_64                macOS 15.7.1 24G231 x86_64
Xcode 12.4 12D4e                            Xcode 26.0.1 17A400
Command Line Tools 12.4.0.0.1.1610135815    Command Line Tools 26.0.0.0.1.1757719676

and have got this :

$=> port -q installed | awk '/php..-openswoole/'
  php74-openswoole @22.0.0_1 (active)
  php80-openswoole @22.0.0_1 (active)
  php81-openswoole @22.1.2_0 (active)
  php82-openswoole @25.2.0_0 (active)
  php83-openswoole @25.2.0_0 (active)
  php84-openswoole @25.2.0_0 (active)

php85-openswoole fails to compile - see openswoole/ext-openswoole#379

@ArtKoKo
Copy link
Author

ArtKoKo commented Nov 22, 2025

  1. Yes, that was a mistake. My initial goal was for OpenSwoole to work with php84 locally. It was only later that I decided to share my work, but I remember why I erase this lines :
  • Official end of life: PHP 7.2 and 7.3 are no longer supported by the PHP team and no longer receive security updates.
  • Security priority: OpenSwoole emphasizes security (the very reason for the fork from Swoole), so maintaining versions for obsolete PHP versions would be contradictory.
  • Official announcement: Starting with version 4.8.0, the OpenSwoole team announced the end of support for PHP 7.2/7.3 following community feedback.
  • Effective removal: Versions 4.11.0 and 4.12.0 officially removed PHP 7.2/7.3, recommending PHP 7.4.32, PHP 8.0.24, or PHP 8.1.11+.
  1. I had some compilation errors with version 22 and I didn't investigate further but here are some answers:
  • Version 22.0.0 introduces features requiring PHP 8.1+ (PSR, GRPC)
  • c-ares and brotli support only in 22.0.0+
  • 22.x/25.x Branch: Active development, new features
  • 4.x Branch: Bug fixes and security only (legacy)
  • PHP 8.0 remains on the 4.x branch as it is nearing its end of life

@BjarneDMat
Copy link
Contributor

you seem to have much more insight into openswoole than I have 👍 I'm - more or less - just a glorified clerk attempting to keep everything current. 🤔
So, in in your opinion it's best to keep every version of php < 8.1 on the 4.11.x branch ?

@ArtKoKo
Copy link
Author

ArtKoKo commented Nov 24, 2025

Okay, your question is relevant, so I investigated OpenSwoole's backward compatibility:

Given that OpenSwoole itself dropped support for PHP 7 in its 4 branch, and that there are no compatible versions available: OpenSwoole never had versions for older PHP 5/7, and that OpenSwoole is a recent fork of Swoole (2021), therefore it has no legacy history.

If I refer to the OpenSwoole articles:

https://openswoole.com/article/v4-12-0-released
https://openswoole.com/article/openswoole-v4-8-0-released

Since MacPorts' philosophy is to support older versions of macOS and PHP, with appropriate and functional extension versions, but not necessarily the latest ones everywhere.

I would recommend this breakdown:

php.branches 7.2 7.3 7.4 8.0 8.1 8.2 8.3 8.4

if {[vercmp ${php.branch} >= 8.4]} {
version 25.2.0
# Support PHP 8.4
} elseif {[vercmp ${php.branch} >= 8.2]} {
version 25.2.0
# Support PHP 8.2+
} elseif {[vercmp ${php.branch} >= 8.1]} {
version 22.1.2
# last version 22.x stable
} elseif {[vercmp ${php.branch} >= 8.0]} {
version 4.12.1
# last version 4.x with support PHP 8.0
} else {
# PHP 7.2 7.3 7.4
version 4.10.0
}

PortFile.txt

BjarneDMat pushed a commit to BjarneDMat/macports-ports that referenced this pull request Nov 24, 2025
@BjarneDMat
Copy link
Contributor

I found your patch in the openswoole bug report and tried to apply it.
BUT it fails. It seems as if you aren't referencing the correct version of openswoole.
In openswoole-25.2.0 the lines you references don't match:

--- a/ext-src/php_swoole.cc
@@ 45,6@@

static swoole::CallbackManager rshutdown_callbacks;

SW_EXTERN_C_BEGIN
static PHP_FUNCTION(swoole_internal_call_user_shutdown_begin);
SW_EXTERN_C_END
@@ 154,6@@
static void php_swoole_init_globals(zend_openswoole_globals *openswoole_globals) {
    openswoole_globals->enable_coroutine = 1;
    openswoole_globals->enable_preemptive_scheduler = 0;
    openswoole_globals->socket_buffer_size = SW_SOCKET_BUFFER_SIZE;
    openswoole_globals->display_errors = 1;
}
@@ 166,6@@
        &function_name, 0, &shutdown_function_entry.fci, &shutdown_function_entry.fci_cache, NULL, NULL);
    register_user_shutdown_function(Z_STRVAL(function_name), Z_STRLEN(function_name), &shutdown_function_entry);
}

void php_swoole_set_global_option(HashTable *vht) {
    zval *ztmp;

@ArtKoKo
Copy link
Author

ArtKoKo commented Nov 24, 2025

Oops, I got a bit cheeky suggesting a hastily written patch based on an old OpenSwoole source code. Here's a patch that actually works: I tested and compiled it with my PHP 8.5 version and it seems to work, tell me.

In the PortFile:

if {[vercmp ${php.branch} >= 8.2]} {
    version             25.2.0
    revision            0
    checksums           rmd160  745e2859737fb01da2adb32ca032c2fd63a4e3ed \
                        sha256  bcc1fed4877b6646cb8f79b092ba03d5e495800465a3fff83c065c58d4312d40 \
                        size    1239054

    # PHP 8.5 compatibility patch
    if {[vercmp ${php.branch} >= 8.5]} {
        patchfiles-append   php85-openswoole.patch
    }
}

php85-openswoole.patch

@BjarneDMat
Copy link
Contributor

The @@ part is incorrect. Should be:
@@ -161,12 +161,27 @@ static void php_swoole_init_globals(zen

curl -L 'https://github.com/user-attachments/files/23725615/php85-openswoole.patch' \
| sed -E -e '1,/^@@/d' -e '/^\+/d' \
| wc -l
12
curl -L 'https://github.com/user-attachments/files/23725615/php85-openswoole.patch' \
| sed -E -e '1,/^@@/d' \
| wc -l
27
#=> port -q installed | awk '/php..-openswoole/'
  php74-openswoole @4.10.0_2 (active)
  php80-openswoole @4.12.1_0 (active)
  php81-openswoole @22.1.2_0 (active)
  php82-openswoole @25.2.0_1 (active)
  php83-openswoole @25.2.0_1 (active)
  php84-openswoole @25.2.0_1 (active)
  php85-openswoole @25.2.0_1 (active)

BjarneDMat pushed a commit to BjarneDMat/macports-ports that referenced this pull request Nov 24, 2025
@ArtKoKo
Copy link
Author

ArtKoKo commented Nov 24, 2025

I've lost count on my fingers...
Thanks for your effort in updating MacPorts !

For your last commit :
Shouldn't the patch only be applied from PHP version 8.5 onwards?

@BjarneDMat
Copy link
Contributor

For your last commit : Shouldn't the patch only be applied from PHP version 8.5 onwards?

The +#if PHP_VERSION_ID >= 80500 takes care of that

@ArtKoKo
Copy link
Author

ArtKoKo commented Nov 24, 2025

Okay, you apply the patch permanently and rely on the patch's condition, that works for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants