-
-
Notifications
You must be signed in to change notification settings - Fork 252
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
Critical error when trying to build all php extensions using --build-micro #468
Comments
|
@jingjingxyk Thanks for your answer! Building with container and define although now receive this error when execute the binary from application: try get around the problem replacing the <?php
declare(strict_types=1);
use Hyperf\Server\Event;
use Hyperf\Server\Server;
use Swoole\Constant;
return [
'mode' => SWOOLE_PROCESS,
'servers' => [
[
'name' => 'http',
'type' => Server::SERVER_HTTP,
'host' => '0.0.0.0',
'port' => 9501,
'sock_type' => SWOOLE_SOCK_TCP,
'callbacks' => [
Event::ON_REQUEST => [Hyperf\HttpServer\Server::class, 'onRequest'],
],
'options' => [
// Whether to enable request lifecycle event
'enable_request_lifecycle' => false,
],
],
],
'settings' => [
Constant::OPTION_ENABLE_COROUTINE => true,
Constant::OPTION_WORKER_NUM => swoole_cpu_num(),
Constant::OPTION_PID_FILE => BASE_PATH . '/runtime/hyperf.pid',
Constant::OPTION_OPEN_TCP_NODELAY => true,
Constant::OPTION_MAX_COROUTINE => 100000,
Constant::OPTION_OPEN_HTTP2_PROTOCOL => true,
Constant::OPTION_MAX_REQUEST => 100000,
Constant::OPTION_SOCKET_BUFFER_SIZE => 2 * 1024 * 1024,
Constant::OPTION_BUFFER_OUTPUT_SIZE => 2 * 1024 * 1024,
],
'callbacks' => [
Event::ON_WORKER_START => [Hyperf\Framework\Bootstrap\WorkerStartCallback::class, 'onWorkerStart'],
Event::ON_PIPE_MESSAGE => [Hyperf\Framework\Bootstrap\PipeMessageCallback::class, 'onPipeMessage'],
Event::ON_WORKER_EXIT => [Hyperf\Framework\Bootstrap\WorkerExitCallback::class, 'onWorkerExit'],
],
]; for this: <?php
declare(strict_types=1);
use Hyperf\Server\Event;
use Hyperf\Server\Server;
use Swoole\Constant;
return [
'mode' => SWOOLE_PROCESS,
'servers' => [
[
'name' => 'http',
'type' => Server::SERVER_HTTP,
'host' => '0.0.0.0',
'port' => 9501,
'sock_type' => SWOOLE_SOCK_TCP,
'callbacks' => [
Event::ON_REQUEST => [Hyperf\HttpServer\Server::class, 'onRequest'],
],
'options' => [
// Whether to enable request lifecycle event
'enable_request_lifecycle' => false,
],
],
],
'settings' => [
'enable_coroutine' => true,
'worker_num' => swoole_cpu_num(),
'pid_file' => BASE_PATH . '/runtime/hyperf.pid',
'open_tcp_nodelay' => true,
'max_coroutine' => 100000,
'open_http2_protocol' => true,
'max_request' => 100000,
'socket_buffer_size' => 2 * 1024 * 1024,
'buffer_output_size' => 2 * 1024 * 1024
],
'callbacks' => [
Event::ON_WORKER_START => [Hyperf\Framework\Bootstrap\WorkerStartCallback::class, 'onWorkerStart'],
Event::ON_PIPE_MESSAGE => [Hyperf\Framework\Bootstrap\PipeMessageCallback::class, 'onPipeMessage'],
Event::ON_WORKER_EXIT => [Hyperf\Framework\Bootstrap\WorkerExitCallback::class, 'onWorkerExit'],
],
]; |
swoole v5.1.2 之前的版本,需要修改swoole 源码,手动添加sapi_module.name=micro ,详见: https://github.com/swoole/swoole-src/blob/16a9122aec63c3b8c80874ec547f7ac39ff58dcf/ext-src/php_swoole.cc#L224 Before version 5.1.2 of SWOOLE, it is necessary to modify the SWOOLE source code and manually add sapi_module. name=micro . info: https://github.com/swoole/swoole-src/blob/16a9122aec63c3b8c80874ec547f7ac39ff58dcf/ext-src/php_swoole.cc#L224 v5.1.2 版本 || strcmp("micro", sapi_module.name) == 0 |
Hmm, now I understand, this change is made directly in the swoole source code... Thanks for explanation! Now the server is working! I found an open issue in the |
For your first build issue, building different combination of extensions before, you may need to delete Swoole currently does not support I need to re-produce hyperf bug on my own computers. But you can try the latest phpmicro, the author of phpmicro has updated and fixed several bugs:
|
Sorry for the delay of the answer. I tested both solutions and they both seem to have worked fine, I don't know what could have happened but delete Now, I'm trying to compile my hyperf application into a |
Using the same spc compilation mode, after adding |
swoole support micro on v5.1.3 |
This problem is related to phpmicro itself. See #476 . Will fix phpmicro upstream |
phpmicro has fixed phar issue, remember cleaning |
Version PHP: 8.1
Command used:
bin/spc build --build-micro "apcu,bcmath,calendar,ctype,curl,dba,dom,exif,fileinfo,filter,gd,iconv,intl,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pcntl,pdo,phar,posix,readline,redis,session,simplexml,sockets,sodium,sqlite3,swoole,swoole-hook-mysql,swoole-hook-pgsql,swoole-hook-sqlite,tokenizer,xml,xmlreader,xmlwriter,xsl,zip,zlib" --debug
Context description: I want to generate a binary file for a hyper application, but I am receiving this critical error that prevents me from using the command
bin/spc micro:combine ../bin/hyperf.php
If I'm doing something wrong or does anyone know of an article or post explaining how I can generate a binary for a hyperf application, I'll be grateful :)
The text was updated successfully, but these errors were encountered: