Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68557 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19275 invoked from network); 17 Aug 2013 23:02:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Aug 2013 23:02:04 -0000 Authentication-Results: pb1.pair.com smtp.mail=jdavidlists@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=jdavidlists@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.181 as permitted sender) X-PHP-List-Original-Sender: jdavidlists@gmail.com X-Host-Fingerprint: 209.85.223.181 mail-ie0-f181.google.com Received: from [209.85.223.181] ([209.85.223.181:43315] helo=mail-ie0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 73/27-18114-BE000125 for ; Sat, 17 Aug 2013 19:02:03 -0400 Received: by mail-ie0-f181.google.com with SMTP id x14so5557848ief.12 for ; Sat, 17 Aug 2013 16:02:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=Zip7c73oecW9AyFBR2ZeYbxrLJAvL0wTzZT5lhshV8o=; b=L4g1gcQWOkpeUC1bXMmaOyRHxuu13MPzowqaCClzfSFpdkR0hMsZprLF7RgBvs7x/t uk+KYoDDdk4ud/SOQ44OIp/Rez4B1/A6LAHSvMr4BjNZZVEKzw0cjQVrP3HgTUKilqka kpI3ddaERtzUt6Q2KazTkrbpk//iUojXxFTaOCv6FUlJIDOBRZwgDXkevILO0VCDoxUn 5MFqzhCbZ7n2zYUQoeT5Pmt7yBKoEoJEUAm1H8Za7iNXdD/4ITklJjNM9NsXuAPgIKZO Yxm+oaeT2BquYaM+hNS8OAEGVgJHItwx02coO4X3il/3gpUI/K5Tnek1bUZZPhiCP6/o 8+Gw== MIME-Version: 1.0 X-Received: by 10.50.109.134 with SMTP id hs6mr88731igb.35.1376676223230; Fri, 16 Aug 2013 11:03:43 -0700 (PDT) Sender: jdavidlists@gmail.com Received: by 10.42.150.196 with HTTP; Fri, 16 Aug 2013 11:03:43 -0700 (PDT) In-Reply-To: References: Date: Fri, 16 Aug 2013 14:03:43 -0400 X-Google-Sender-Auth: Kjfb9gavE1nKCy0hAbcvv_pU5NU Message-ID: To: Sara Golemon Cc: PHP internals Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Interest in a "null" SAPI for embedding? From: j.david.lists@gmail.com (J David) On Fri, Aug 16, 2013 at 12:40 PM, Sara Golemon wrote: > Apart from managing lifecycles, the SAPI is also resposible for things li= ke > directing I/O between the host application, how does null-sapi handle thi= s? It doesn't. It provides no SAPI functionality at all (hence "null"). Its only purpose is to allow building SAPIs separately from building PHP by leaving all that stuff out. The sapi_module_struct and all its callbacks -- including but not limited to I/O handling -- are provided later by the externally-built SAPI. This offers several benefits: - it makes embedding PHP easier and more flexible. - it allows new SAPIs to be developed and distributed independently of the PHP source tree (i.e. as part of a web server or as a separate package) - it (hypothetically) makes SAPIs modular and able to be selected at runtime rather than build time - (therefore) it allows multiple SAPIs to coexist in a single installation Obviously our use case is the first/second. The last two benefits are hypothetical, since they would require existing SAPIs to be tweaked. E.g. currently the CLI SAPI and the apache2 SAPI can coexist, but they do so by building the entire PHP runtime into both =85/bin/php and =85/apache/libexec/mod_php5.so. If they were tweaked to build with null-sapi: - the "main" build would be null-sapi which produces only libphp5.so with no SAPI code - the CLI and apache2handler SAPI's would be built after/separately from the "main" build, like extensions - the CLI binary and mod_php5.so would both link to the same shared libphp5.so at runtime, instead of the current approach where they both contain the entirety of PHP. Modifying the existing SAPI's would be a bigger step and may not be desirable for other reasons. It isn't something we have pursued or consider necessary; the first two benefits were sufficient for us to justify doing this. But the issue of building multiple competing SAPIs from one tree does come up from time to time, so if you want to, imagine a possible bright future world of arbitrary happily coexisting SAPIs. :) Thanks!