Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111199 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 16755 invoked from network); 27 Jul 2020 08:05:37 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 27 Jul 2020 08:05:37 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id ADE271804D0 for ; Mon, 27 Jul 2020 00:01:13 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-oi1-f169.google.com (mail-oi1-f169.google.com [209.85.167.169]) (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 00:01:13 -0700 (PDT) Received: by mail-oi1-f169.google.com with SMTP id w17so13495918oie.6 for ; Mon, 27 Jul 2020 00:01:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7zaazV+rxw4eXA1CZ8wMS5+TvDmIkRSxrbaiM89mqGk=; b=QQffjOwfowNF55K0qSdfLDOS3IxAYQA/a0ZpSvgRqKe0yIE7iDw7LtOuqrnGI8vgGC L0nhyloCUs25hcI284ajfsAev0y926If1Kgy5pnUG4K8wud0GInp29lQRqaPUka0yuVI jFYZ6hv2+svV2xD5pW+VLweyag8ydU1SnIVmQxxAEY9dL0VkmUiG6AK8Fo8Nh4g4KmE4 bRi+8McHvYuLvQ+2J+wrvqSeWW4wEesa944FAyMdeCMtXjbPLA2Yq3AFGk3K4XhzzUYT Oz5zV8FVfn3CrXvADQ2FBROTILqcFzhKJaa2geXxmqq81S5BuB0M/Ct3C1Np0YMtYpQS QqVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7zaazV+rxw4eXA1CZ8wMS5+TvDmIkRSxrbaiM89mqGk=; b=VbexGe/IEDtP1AAbRj8H0jDC1Ddfo9yYTcEtCYAbNAQJ0n7mI8E/9+FFBOYJDZ6wwV AcqU2SEuXwSo7Vpel/HjsocPH1oqKbiLLMtHf5pclfzehWq4e3CPP/fjUP01HL2WDaW7 +S2ltHw2oWX5H2DtsyiGBfoZusqdWCoCpGi2AbOTLU1PRPBIMzk41JkJDjqWSFJKIfEL C9v+1IKlMFM5L40wyTQCbxtuKBo4Hc2i2HBg1JKnstae6EUKA8aMklZuXYMHrzl7+3ju gerwucc+EDXu3+JUyVXHnvkSo79Huv+5bFPKHWQgghrz8pMMHppqIiHvjdj1L21Y7u2F P2Sg== X-Gm-Message-State: AOAM531ov3u7BbuYvDDb4LrqGNbeiB80ElEGgZds8JtG1JcA+D/ieU2/ dq6k8kLMVI7SScfMY+7qILO5dYzK5D08dRNIm1rGAw19d9c= X-Google-Smtp-Source: ABdhPJyTZ3AWkUYAVTwQJ3MH51AU/ZOCGAnWD2+OOjdRvLffZg7Wf+/Fvcim3FBLdk5LCQkcrh8g6ZwN1t+i4JoqDsU= X-Received: by 2002:aca:4ec1:: with SMTP id c184mr17567217oib.112.1595833272306; Mon, 27 Jul 2020 00:01:12 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 27 Jul 2020 09:01:00 +0200 Message-ID: To: Derek Bonner Cc: PHP Internals List Content-Type: multipart/alternative; boundary="00000000000051103f05ab66e389" Subject: Re: [PHP-DEV] Proposal: php.ini environment variable fallback value From: michal.brzuchalski@gmail.com (=?UTF-8?Q?Micha=C5=82_Marcin_Brzuchalski?=) --00000000000051103f05ab66e389 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Derek, pt., 24 lip 2020 o 22:54 Derek Bonner napisa=C5=82(= a): > Currently an environment variable can be specified in the php.ini file. > This is useful if you want tune one or two settings in your runtime > environment. Where this runs into issues is if you want to do something > similar to Juan Terminio[1][2]. > I do agree that this is hard to apply INI setting on Docker environment. > I'm proposing a change the php.ini parser that would allow for an extende= d > syntax for environment variables in the php.ini. In this syntax when > checking for an environment variable if it is empty the fallback value > would be used instead. The original environment variable syntax would > remain valid as well. > I disagree here. IMO INI setting should remain static. > Possible syntax options. I currently do not have a very deep understandin= g > of the current .ini parser so this may make invalid assumptions. > > * memory_limit =3D ${PHP_MEMORY_LIMIT:-"default value"} > * memory_limit =3D ${PHP_MEMORY_LIMIT::"default value"} > * memory_limit =3D ${PHP_MEMORY_LIMIT:=3D"default value"} > * memory_limit =3D ${PHP_MEMORY_LIMIT=3D=3D"default value"} > 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. Why it cannot be handled by a specialised library? 1. On environments with dl disabled you cannot load additional extension without adding it to INI files or by `-dextension=3D[ext]` CLI option. 2. If you struggle with memory limit or time limit you cannot change it if the script calls another script via proc_open or exec without applying INI file setting, even a CLI option won't help here but an environment variable could. 3. In modern stacks like k8s or Docker when a container is immutable per se, you cannot modify for eg. memory_limit, or enable/disable OPcache, tune OPcache flags, enable/disable Xdebug without changing INI files but you could do that easily by an environment variable, via docker-compose environment settings, docker -e options, or by editing a deployment on k8s by hand to apply different settings for investigation purposes. I'd like to hear other opinions about it. Cheers, Micha=C5=82 Marcin Brzuchalski --00000000000051103f05ab66e389--