Newsgroups: php.internals,php.internals Path: news.php.net Xref: news.php.net php.internals:122110 php.internals:122111 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 6273 invoked from network); 4 Jan 2024 17:21:00 -0000 Received: from unknown (HELO localhost.localdomain) (76.75.200.58) by pb1.pair.com with SMTP; 4 Jan 2024 17:21:00 -0000 To: internals@lists.php.net,=?UTF-8?Q?K=c3=a9vin_Dunglas?= , internals@lists.php.net Message-ID: <497e4897-c7c8-79e3-f91f-447356e5c9ce@kumbiaphp.com> Date: Thu, 4 Jan 2024 18:20:59 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Content-Language: en-US References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 37.152.87.60 Subject: Re: RFC proposal: worker mode primitives for SAPIs From: joanhey@kumbiaphp.com (Joanhey) Hi, I like it for start a discussion, than it's necessary. But we need to see the big picture. The CLI-SAPI is the poor brother in PHP (contrary to other languages), but that is another discussion than I'll try to open later. Create a Worker-SAPI? First any CLI worker can't access the SAPI. So they don't have any benefit. So Amp, React, Revolt, Workerman, Adapterman, Symfony runtime,... can't access the internal SAPI functions. Each need to recreate in user land PHP code for functions that already exist in PHP sapis. Kudos, for the RFC RFC1867 from Ilija. But we need to go farther. It isn't possible use header functions :(, https://github.com/php/php-src/issues/12304 Later we have SAPIs than use PHP embed (really easy to use :)) or in a similar way. Here we find 2 ways: forks or threads!! With forks we can use Super-Globals, with threads it's impossible, and for that they need to encapsulate it in Request/Response objects. How we'll join both situations. Here start the discussion. Forks: Frankenphp, RoadRunner, Ngx-php (the fastest PHP runtime),... Nginx Unit still use a shared nothing approach, but it's really easy to have both. Threads: Swoole, OpenSwoole, Swoow,... in that situation the super globals are NOT possible. Here some frameworks permit use both (forks or threads) depending on the master event loop that we choose. But they need to force all to the threads way to have a unified interface. We are talking about the main loop, because inside we can use any thread system. Thanks to all, and to Kevin to start the discussion. PD: Actually any new PHP SAPI need to be added to the php-src to have OPCache enabled. Nginx Unit and other still use cli-server SAPI to have it. That need to be changed, so any SAPI can call it, without register. Regards Joan Miquel