-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
php-swoole: update to latest versions, php-openswoole: new port #30146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
- 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
|
Notifying maintainers: |
|
duplicate of work in #28140 |
|
Not really, the same work for openswoole with the dependencies... |
incorporates work from macports#30146
|
So, I implemented your work in my PR28140
I've tested on my platforms : and have got this :
|
|
|
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. 🤔 |
|
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 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:
|
incorporates work from macports#30146
|
I found your patch in the openswoole bug report and tried to apply it. |
|
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: |
|
The |
incorporates work from macports#30146
|
I've lost count on my fingers... For your last commit : |
The |
|
Okay, you apply the patch permanently and rely on the patch's condition, that works for me |
incorporates work from macports#30146
incorporates work from macports#30146
|
We might need to re-open and take a fresh look at the |
This commit addresses two critical issues preventing php-openswoole
from building and running on macOS with PHP 8.5:
1. PHP 8.5 API Incompatibility (Segmentation Fault)
- Problem: PHP 8.5 removed the 'fci' field from php_shutdown_function_entry
- Symptom: Segfault (exit 139) when loading openswoole extension
- Root Cause: php_swoole_register_shutdown_function() attempted to access
the removed 'fci' field in shutdown_function_entry structure
- Solution: Created php85-compat.patch that uses a temporary zend_fcall_info
structure to initialize fci_cache, then only passes fci_cache to
register_user_shutdown_function()
2. macOS Build Failures (Linux-specific Functions)
- Problem: OpenSwoole uses 10 Linux-specific functions unavailable on macOS
- Functions disabled via post-patch reinplace commands:
* pthread_spin_lock / pthread_spinlock_t (no spinlock types in macOS)
* pthread_barrier_init / pthread_barrier_t (no barrier types in macOS)
* pthread_mutex_timedlock (not available on macOS)
* pthread_mutexattr_setrobust / pthread_mutex_consistent (no robust mutexes)
* getrandom (use arc4random fallback on macOS)
* accept4 (Linux-specific socket function)
* signalfd (Linux-specific signal handling)
* malloc_trim (GNU-specific memory optimization)
* epoll_create (Linux-specific I/O event notification, use kqueue on macOS)
- Solution: Disable detection of these functions in config.m4 via reinplace
Changes:
- Portfile: Incremented revision to 11
- Portfile: Added post-patch block with 10 reinplace commands to disable
Linux-specific function detection
- Portfile: Added conditional patch application for PHP 8.5+
- Added files/php85-compat.patch: Fix shutdown function registration for PHP 8.5
Testing:
- Compilation successful on macOS 15.7.2 (arm64) with PHP 8.5.0
- Extension loads without segfault: php85 -d extension=openswoole.so -m
- Basic functionality verified: OPENSWOOLE_VERSION constant accessible
- HTTP Server creation works: new Swoole\HTTP\Server() succeeds
Closes: macports#30146
…ity fixes
This commit updates php-swoole and adds comprehensive support for PHP 8.5
and macOS build compatibility.
Changes to php-swoole:
1. Version Update
- Updated from 6.1.2 to 6.1.4
- Updated checksums for new version
- Added PHP 8.5 to supported branches
2. macOS Build Compatibility (all PHP versions >= 8.1)
- Added post-patch block to disable Linux-specific pthread functions
- Disabled 10 Linux-only functions not available on macOS:
* pthread_spin_lock (no spinlock types in macOS pthread)
* pthread_barrier_init (no barrier types in macOS pthread)
* pthread_mutex_timedlock (not available on macOS)
* pthread_mutexattr_setrobust (no robust mutex support)
* pthread_mutex_consistent (no robust mutex support)
* getrandom (use arc4random fallback on macOS)
* accept4 (Linux-specific socket function)
* signalfd (Linux-specific signal handling)
* malloc_trim (GNU-specific memory optimization)
* epoll_create (Linux I/O notification, use kqueue on macOS)
3. PHP 8.5 Compatibility Patches
- Added php85-runtime.patch: Fix runtime API changes
- Added php85-sapi.patch: Fix SAPI layer compatibility
- Added php85-shutdown.patch: Fix shutdown function registration
- Patches applied conditionally for PHP 8.5+
Changes to php-openswoole:
- Minor formatting cleanup in Portfile header
Testing:
- Built successfully on macOS 15.7.2 (arm64)
- Tested with PHP 8.1, 8.2, 8.3, 8.4, and 8.5
- Extension loads without errors
- Basic HTTP server functionality verified
|
You're right, I tried using the ports but it didn't work. The OpenSwoole and Swoole versions for PHP 85 require a lot of patches to work; I've committed both. I'd appreciate it if a MacPorts maintainer could review the two ports, as I'm not an expert… |
incorporates work from macports#30146
incorporates work from macports#30146
|
|
I've tested the very, very basic functionalty of both php-openswoole and php-swoole in @ArtKoKo If you've got a php script that tests more extensively, I'll be happy to implement that 🤓 |
|
I adapted one of my previous scripts to check Apache, execute:
Example result:
|
Restoring older versions 7.2 and 7.3 that were accidentally deleted
incorporates work from macports#30146
incorporates work from macports#30146
incorporates work from macports#30146
incorporates work from macports#30146
This doesn't work on macOs . macOs sorts ASCII 123..126 as being !before! 'a' 🤔👎🏻🤓 |
Summary
This PR includes two changes:
php-openswoole (new port): High-performance network framework for PHP
php-swoole (existing port): No changes, maintained for reference
Testing
port lintNotes
Type(s)
Tested on
macOS 15.7.2 24G325 arm64
Command Line Tools 26.1.0.0.1.1761104275
Verification
Have you
port lint?sudo port test?sudo port -vst install?