Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111208 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 84060 invoked from network); 28 Jul 2020 06:23:21 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 28 Jul 2020 06:23:21 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id AEA72180510 for ; Mon, 27 Jul 2020 22:19:09 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 27 Jul 2020 22:19:08 -0700 (PDT) Received: by mail-wm1-f47.google.com with SMTP id f18so16850268wml.3 for ; Mon, 27 Jul 2020 22:19:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=derekbonner-com.20150623.gappssmtp.com; s=20150623; h=from:in-reply-to:references:mime-version:date:message-id:subject:to :cc; bh=g8AFB1lOTF78TwaBL8pHugCgTh0kvDRkkOIvnek70as=; b=YwnHZagA9FU310QRjorP6M0LWgMLjdqwdeuLQ9aw5J97Wan2om+t0MFnI5HNE4i4YO A4Youmk7Oif40efZPi26X7hOXx78/xOzHRrpDu4HLI/wrOoFQ0uqFLdBLcjTOhjjHI5f reEjkIMJv54/QP77bOkJmlrv9GlSzobGnixEil6+EfeVc0fPla6I0VqDXsxH4LSjvE57 ZoZN93c6ODkNes2MFKXkHcXmo4teoNWyJDnNTI+TGXbqE9w4T0hZfs9EGqJmGQcpSUOE 8kFf3UOz4j3cRSWTnfHjY5Vn+PpnihdrMkI/Z4UooItM0lu57UpvfXQ4qMl3iGAdO2fc HnPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:in-reply-to:references:mime-version:date :message-id:subject:to:cc; bh=g8AFB1lOTF78TwaBL8pHugCgTh0kvDRkkOIvnek70as=; b=SyEWC5eXbpi1GXa4vjnSoJgUuL4j9afZuhCtXvimetuTQklyGIIKyRzh/n6ev9YSVj aG+pvahUyKosqNC9Sswl4WcxynnXsvceO9NFoXqojNgZ3Y4xdpOn6faGYyYSUvEFvlCz cWaleqXYHliUKpvjrJaGEFLCkniuBaTZRCyHEygWSy46Lw2zO1MdoZ+Txpq/6g3ev2Ph MF1i/ZbI+7ti1zQmQo7S7sH3kLUzCaIvFBA/+QACZGmo8b6Xq4M8UYVahzmHKzEy8aAy wb4x8yrdXkcsOHZMn5tYEwCC/ALES9H1+dlUo6UxpCSgu2g0sQo4Lq3mOQ1AknG4LVeO WX8w== X-Gm-Message-State: AOAM530RimDqsKphPBydeBk00UxQ2KUPqN1fg4VAjiXwjW3WQZda/Xqz QApCCQqSuXIDjoQ8M32RtQaKYSAygXsCag2rnhv4JQ== X-Google-Smtp-Source: ABdhPJw7NgzpDXp2FJ0tat/W+zP7ozbDrdquIjV27NkUOmD5IRsJKKPZI9B6Y28A/5EvV+tyBPADLxPdAWw84SUjxVo= X-Received: by 2002:a1c:19c5:: with SMTP id 188mr2221209wmz.124.1595913546705; Mon, 27 Jul 2020 22:19:06 -0700 (PDT) Received: from 1058052472880 named unknown by gmailapi.google.com with HTTPREST; Mon, 27 Jul 2020 22:19:05 -0700 In-Reply-To: References: MIME-Version: 1.0 Date: Mon, 27 Jul 2020 22:19:05 -0700 Message-ID: To: Michael Morris , =?UTF-8?Q?Micha=C5=82_Marcin_Brzuchalski?= Cc: PHP internals Content-Type: multipart/alternative; boundary="0000000000000b3fd605ab79946d" Subject: Re: [PHP-DEV] Proposal: php.ini environment variable fallback value From: derek@derekbonner.com (Derek Bonner) --0000000000000b3fd605ab79946d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On July 27, 2020 at 8:27:07 PM, Michael Morris (tendoaki@gmail.com) wrote: You mention Docker - usually I've seen it used alongside Ansible, Chef or Puppet. Each of these provisioning programs can modify the php.ini file used on the container at deploy time without necessitating a change to PHP itself. What advantage does the community gain from moving these decisions from the provision files to the php.ini file? My use case is specifically Docker and Kubernetes. Like Michal said, containers aim to be immutable. When we deploy containers they are built via CI with a specific base image sets up PHP with the extensions we need and then creates a layer for our application. That means to change any one configuration value in the php.ini file would trigger a rebuild of the container.CI would then rebuild the container and deploy it. That can take minutes at times. The quick way would be to change an environment variable, mark all old containers as bad and any new ones pick up the new environment setting as they fill in for the bad ones. Another use case. We have a private Kubernetes stack for a specific client. With environment variables we can turn the php.ini using environment variable but each time a new config value is used this way we have to make sure that same environment variable is exposed to the container. The ability to have a fallback value while not 100% necessary does have the ability to reduce errors around environment variables in Docker/Kubernetes deployments. We don=E2=80=99t use Ansible, Chef, or Puppet. Everything is CI and kubectl= . I might understand using these tools if you are running your own Kubernetes stack but we are not currently doing that. On July 26, 2020 at 10:18:23 PM, Micha=C5=82 Marcin Brzuchalski ( michal.brzuchalski@gmail.com) wrote: Personally I like the idea of setting ini directives via environment variables but not by a complex syntax in ini files but rather by looking up for a directive by environment variable name and setting it up directly for instance: PHP_MEMORY_LIMIT=3D1G php script.php Being equivalent of: php -dmemory_limit=3D1G script.php This seems like a reasonable alternative. With this would the php.ini be the fallback value I=E2=80=99m looking for with the environment variable on= ly being used if present? On July 27, 2020 at 12:01:13 AM, Micha=C5=82 Marcin Brzuchalski ( michal.brzuchalski@gmail.com) wrote: I do like the idea of applying INI settings with environment variables but I believe we should not change anything by providing complex INI parsing rules. Your proposal inspired me to think of it more and think of potential RFC for changing the configuration mechanism we use in PHP so it can be slightly refactored and extracted from zend_ini into zend_config with additional configuration providers for "argv" values, environment variables, INI settings and extension provider. I believe and hope it has a potential and allows us to make things more clear when talking about INI settings. We always talk about INI settings while INI is just a file format and we apply internally INI settings from different sources like `-d` options from the command line or provided by extension like mentioned in the thread .htaccess. In summary, potential RFC proposal would be: 1. extract zend_config from zend_ini, INI directives will in a future be considered a configuration settings/directives whatever; 2. implement different prioritized configuration providers for CLI argv, INI files, ext, environment variables - allowing to resolve configuration settings in a specific order This will in a future open wide range of possibilities, like new formats to be implemented via file format, specific configuration provider. That sounds a little more complex that I was aiming for but does solve the issue in a different way. I however wouldn=E2=80=99t be able to write that = code currently. Thank you kindly for the responses. One comment I=E2=80=99ve seen that addi= ng this proposal would make the php.ini file no longer static. Can you please clarify how memory_limit =3D ${PHP_MEMORY_LIMIT} is any less static than memory_limit =3D ${PHP_MEMORY_LIMIT:-=E2=80=9C256M=E2=80=9D} To me the ini setting is both static and deterministic. They may have different outcomes under the proposed change but that doesn=E2=80=99t make = it dynamic. Cheers, Derek --0000000000000b3fd605ab79946d--