Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125997 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 7A5FD1A00BD for ; Tue, 19 Nov 2024 23:31:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1732059243; bh=r3StgRngMcsiNKk8Ohq3xc8IeqKgAl/pGyQdpT5f6M8=; h=Date:Subject:To:References:From:In-Reply-To:From; b=GwJtUqNYZAbu+gCBb5sEQnvAnt8dVQCnTLpEmOS5kYvHrrOScS58XXRrLGJ33M5eQ CjijPYtGTSGABrkSRpJl26gy3ZQxU+0gW2KkjPGXXj8apR8+su1L+9SfRA0jbuIp1Z sl8mJ/NLLLDMz8dkRWgCiLXgswP+7V8yRNaCIjkKxi24+dCDabVRCLWLgOvkwAh8zW XZO/1RrJk1h43gTE8YeQMQleQQd6fD2U2Ep/v5m6I2C+aDir/YFHWFnRinTdez6Nqz B0pvSE+4moCAk0KpGvcXoiBZnHCBVhbETq2STRuKFBEq8SU2sqdwZsEkRbFh6SGEqv nFwn3U6EGt6nw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2BB4E18002F for ; Tue, 19 Nov 2024 23:34:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DMARC_MISSING,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 19 Nov 2024 23:34:00 +0000 (UTC) Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4315abed18aso33217505e9.2 for ; Tue, 19 Nov 2024 15:31:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=scriptfusion-com.20230601.gappssmtp.com; s=20230601; t=1732059080; x=1732663880; darn=lists.php.net; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=+vZe5hYUrTdqlaVdRx4pwXeQPWnCYzetXUEL68S7tcc=; b=qvZeL7MU38MuHgS2+3rwOSi7ZnkBJeF+i86Go09tKaqYRzBEugmjk3dM2ldYol/5pq z5HbWxxguBWAOCKZWKzkbK6y9ArEMQf9WKus2rFdXtq1EZo2LUT0XeSvQ1w2FDKLBvwW JEutAy1Uu4TVmrtRVnUppsDsu87qp6lZSPlRPuZ+W6sCghB3k5YOOlhb0WXE4tpQA5xC i9BporIUUpwDxL+l8RcStbIdzZrl1VH2aNrsxPwBmRF9Qh1nYWsUkTGP033AtdUwt9+o 9JNsbsoXhNkN+PICqynmk476wHiIfNR/4flpVdBmjbw6UFqlCm6b4LBKTwmPywNeyNYu ukCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732059080; x=1732663880; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+vZe5hYUrTdqlaVdRx4pwXeQPWnCYzetXUEL68S7tcc=; b=lt76VRdY2QUS6A+1tMDvl/cm1BukNB2mX3vgxvSdgAee2GM8fbBkRF7GoaCu6lQrq7 fEaiw4Wyisl3z8qiZlJI/tFEMsdE6bLXaqbMGRaxP3sRl5vJjgBG5ghwcKmGxmrYzCbR s/n8K1Fii0DMmReEgq78yGGWf/8rT3Jd3mT8yosy0p8dsPTTFeYkPcNZ2lKNzGMaMFKj KCIvS7kOQ8msU/EZeKcKv0zbX+RqkBRu0iTFJ3NAXoUnkLDX676vlQKL3XRhIemFJ+XB rZNTSh8M60rdTxhRIOQarBrrxJ/afgL92W29A1uJsImzdJ+B0RqHummKK7jKq4NX1Msr 1fPg== X-Gm-Message-State: AOJu0Yx80+wAHC2gqrZhKKp17y5AUN2xKFtcrAYbx7wGklPeO94/Z1dV t7i93lRLuBrtQIetxPEw8h/NjSQ5ZS5z4fz01E1tY8qSYOAa2MRNWO1otYlLV7M8hmD4Ul848un 2QwE= X-Google-Smtp-Source: AGHT+IGdBb6AuxFbMbmWUdzsCVKCdCmf4oxHG/W2oAH6dm94zTw5OlfumPBPxjReCuUD3PTCSO9PoQ== X-Received: by 2002:a05:600c:3b0c:b0:432:d875:c298 with SMTP id 5b1f17b1804b1-433489b820emr6019845e9.14.1732059080073; Tue, 19 Nov 2024 15:31:20 -0800 (PST) Received: from ?IPV6:2a01:4b00:bf09:5101:c67:ac9b:96be:5e92? ([2a01:4b00:bf09:5101:c67:ac9b:96be:5e92]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-3825493ea2bsm537355f8f.87.2024.11.19.15.31.18 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Nov 2024 15:31:19 -0800 (PST) Message-ID: <7ef4323d-1a68-4ab5-84bb-912b98965385@scriptfusion.com> Date: Tue, 19 Nov 2024 23:31:18 +0000 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] Better development streamlining of the built-in server To: internals@lists.php.net References: <1ccdaa01-bbe7-4ac6-a7a9-db43f9e4537b@scriptfusion.com> <046d6f81-9981-45b7-8da5-a7fed8e11eaa@rwec.co.uk> Content-Language: en-GB In-Reply-To: <046d6f81-9981-45b7-8da5-a7fed8e11eaa@rwec.co.uk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit From: bilge@scriptfusion.com (Bilge) On 19/11/2024 23:14, Rowan Tommins [IMSoP] wrote: > On 19/11/2024 13:48, Hammed Ajao wrote: >> >> So if symfony and laravel do this, whose best practices are we going >> by exactly, yours? > > > One common citation for this is "The Twelve-Factor App" > [https://12factor.net/], a methodology/manifesto published in 2011 by > some engineers from Heroku as a way to build a particular sort of > cloud-native service-based application. Coincidentally, an open-source > project to update and expand on it was officially announced last week: > https://12factor.net/blog/open-source-announcement > > The idea is that "in a twelve-factor app": > > - configuration comes directly from the environment; for instance, > provided by the orchestration layer in a container-based deployment > - it is not written to a file, but passed directly to the application > as environment variables > - it does not indicate a named environment, but configures the > application directly > > > When people struggled with development environments which didn't have > a suitable place for these variables to come from, the ".env file" was > invented - a way to emulate the environment variables that a "real" > deployment would receive. > > This then took on a life of its own, and eventually ".env" became just > another format for configuration files: instead of "development.ini" > and "production.ini", you have ".env.development" and > ".env.production". We came full circle, and the only thing which > actually comes from the environment is a master switch to choose the > file to load. > > > Personally, I don't think there's anything wrong with the "master > switch" approach for a lot of applications. Not everybody works for a > company with hundreds of developers, and a dozen kubernetes clusters > running A/B tests on continuously deployed code. Sometimes you really > do know you have 2, or 3, or 4, environments to configure. > > However, I don't think the master switch is something that should be > hard-coded in a server. Maybe you know that if it's running under "php > -S", it's "dev mode", and it it's running under Apache, it's "live > mode"; if so, you can look at PHP_SAPI / php_sapi_name(). But maybe > you do run Apache on a dev server; or you have separate debug and QA > modes. > You wrote the perfect post summarising a brief history of configuration injection and brought it back to the main point that the master switch does not belong in the web server, and I hadn't heard about the 12factor open source announcement so I learned something new, too! Bravo. Thanks for posting this and agree with everything stated herein. Cheers, Bilge