static-php-cli: Error when trying create binary build of file a .phar from hyperf application
Hi @crazywhalecc! I have a new problem with build
New phpmicro update resolved the initial error from issue #468, but now I’m getting a new error.
I followed the instructions to remove the buildroot and source folders and run bin/spc del-download micro && bin/spc download micro
However, when I try to run the binary with ./my-binary it shows the hyperf commands normally
Now, if I actually try to run the server with the ./my-binary start command, it shows error logs
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (10 by maintainers)
workaround of this issue:
@wheakerd I just tested the latest Swoole, PHP and Hyperf frameworks. The problem can be solved after closing
SWOOLE_HOOK_FILE, but there is still a problem if it is included. It can be determined that the problem is caused by Swoole’s coroutine hook.@wheakerd In theory, static-php does not have any special handling for PHARs when building micro SAPI. The only possible problem is reading the PHAR itself from the code in the PHAR.
But at present, except for Hyperf+Swoole, I have not received a minimal reproducible example. Maybe we can try whether the latest swoole has this problem.
Here’s a possible workaround: https://github.com/crazywhalecc/static-php-cli/issues/479#issuecomment-2480521473
I tried hyperf locally, checked the source code, and also tried to package a pure swoole application. Only the hyperf package had this problem. Maybe the problem is caused by hyperf itself. We need to hand it over to the hyperf author to check the problem.
The memory limit issue you mentioned is spc bug (the micro and phar file is too large), and I will fix it later. And I’m searching and testing hyperf packaging command now.