Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:44585 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8860 invoked from network); 1 Jul 2009 18:15:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Jul 2009 18:15:29 -0000 Received: from [127.0.0.1] ([127.0.0.1:25364]) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ECSTREAM id BF/D3-24906-DB7AB4A4 for ; Wed, 01 Jul 2009 14:15:25 -0400 X-Host-Fingerprint: 91.123.14.188 unknown Received: from [91.123.14.188] ([91.123.14.188:10191] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C9/D2-24906-9A4AB4A4 for ; Wed, 01 Jul 2009 14:02:17 -0400 Message-ID: To: internals@lists.php.net Reply-To: "Gelu Kelunden" Date: Wed, 1 Jul 2009 21:02:06 +0300 Lines: 24 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Windows Mail 6.0.6001.18000 X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6001.18049 X-Posted-By: 91.123.14.188 Subject: CGI and FastCGI SAPI From: gelu.kelu@gmail.com ("Gelu Kelunden") Hi, I'm trying to understand how difficult it is to create a new SAPI, so I started to poke my nose inside the "cgi" SAPI source code. I saw that "cgi_main.c" implements both the CGI and the FastCGI protocols and I kinda got lost inside all those if-else lines (I tried to take out the FastCGI code and failed miserably). I'm wondering if it's not better to have 2 different SAPIs, one for CGI and for FastCGI. Advantages of this "split" would be: - the source code will be more readable without all those if-else statements - we would have 2 executables that do 2 different jobs, unlike now where php-cgi does both; each executable could then be further optimized for the exact job they are performing Disadvantages I see: - maintaning 2 SAPI implementaion would require more work (since CGI and FastCGI both share most of the SAPI code, any change would have to be replicated twice) - break backward compatibility (where php-cgi handles both CGI and FastCGI) Thank you for your time, Gelu