Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125988 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 EDC421A00BD for ; Tue, 19 Nov 2024 12:34:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1732019827; bh=OBXvHCDLpvUHDdxsW4Wda7U/evT+J2p88Atk0YS0IJo=; h=References:In-Reply-To:From:Date:Subject:Cc:From; b=a7u+njrgVWD2I3oSXmxyf6w2/lAZ3c79erDcv+6RZ5mAuI+kjedwQv93xJPj/LY59 wHfMLjSiCH4TMF+BTyKHDGfhIwzCa4EtJNqgzU3UXC/LRmj0raoLtRslmuqSnSwD7l FCYhjUHUZm6lGLVG/EhXoh7IIyJCPhQMbGKv5oNmZYfxmBwuQqh2jE2YFhgcGwcJbo n0FsxHok5KU2lYfuBsjuHxyttVzu1f4OuUeQi1aF/qismoSOhl7VIuVk9ZnRt012dC W6SSTuVPeMPh/wkuQFzev1Kjjq7FdW7vCv+tvM3ZXFVcdISAGc0tEeoX7YANsRAIkU s9w6rUGoM2cMg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1563418003E for ; Tue, 19 Nov 2024 12:37:07 +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=3.8 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,MALFORMED_FREEMAIL,MISSING_HEADERS,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-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (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 12:37:03 +0000 (UTC) Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-539e63c8678so3441490e87.0 for ; Tue, 19 Nov 2024 04:34:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732019663; x=1732624463; darn=lists.php.net; h=cc:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=lufgx3RjrtCaZeSigcgr+fH8xdR0LM0p2iL/U1FhYpg=; b=VViu1wB928CZoLB9JyqhxTgYgZv8eLxkJzD4tPyx6HzZ9Xewi8mgEBoLU9sOdh983E FQ3tDlwnJBoGqlOD/pAl5FnLRR27sXv2RotOuL5aUzrkqRk9vSwlE3cQo6epwGYkblGT 2BUtvV9rXZm3JwUrcec3GLBWkJzRRkVWl/Fhjx8j7KmK/Pg+hhEcdsl1EGqhTLY5W/zm 8KcGyyfJrk5MOrkvBoK8dyRtHqYFxqlyp5AqkngulY8qb7IO6UvgCA4yk1V0eDc7lohT 7P5PrxoPKNWw+3RFew8IwtTx6EzKSvVSaI5+2T5ijnRVc1ul+BVpFDdD5Qh2mxSIJGdH ORqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732019663; x=1732624463; h=cc:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lufgx3RjrtCaZeSigcgr+fH8xdR0LM0p2iL/U1FhYpg=; b=UfNycvcWuqFopODqW015ewnQ/ItNVhuaaHBQtdEz+dkb7Lf0UNHQ5QSQDmJtZrrjUB lGU+8sXApYcCexbQUrVlEFvZXod/uUrIaopS6e6uKIQhjWpOroyOCrZNYfqgligNJxyh yHPWjANK7Ne2RDEaePv2X3H242SWgBP+r6BEvRQLSuUh4KAI8rRMg9x0eYZflt2P38FN pYItyXFCxRggSnGyU27GBhvCucmQj8zahngYmyL9ir23gE3KzybYKRX41VkZrWpvKcey 45g30DeyumymByLwXyDzmQt3U61fdEU4CbsW6NyUh6/tzJ1TYPFcERziOYuqUWOp9IlL tGLA== X-Gm-Message-State: AOJu0YwXBT8F7VyenoV+yMh4iLcKtS3iH++MeyY6lHXKVhzfgl72LmIn BL3j9r2Q6aSpT2scAhRqZ3dzLEhCkOtznQbYy7fVnb8UuVOKdCHFfzgswTSwdSAr+6GTZykzApH Uyc2Hm85mP0td6nNPNuWvWjoNFfzuh0JY X-Google-Smtp-Source: AGHT+IHdlgrPmPuUfex+Q99bX7OcDRz4j4lTgGgS1j8z6RegEunfVRe3/DEsShIL0Y9ATCxNu2Qq5I3Uwis5Nub7UfQ= X-Received: by 2002:a05:6512:b88:b0:539:8a9a:4e63 with SMTP id 2adb3069b0e04-53dab2b97fdmr6145986e87.42.1732019662668; Tue, 19 Nov 2024 04:34:22 -0800 (PST) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <25ebe5db-6db4-4fe7-b75e-07ae43443ee3@email.android.com> In-Reply-To: <25ebe5db-6db4-4fe7-b75e-07ae43443ee3@email.android.com> Date: Tue, 19 Nov 2024 13:33:56 +0100 Message-ID: Subject: Re: [PHP-DEV] Better development streamlining of the built-in server Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000bccdcb062743408b" From: weirdan@gmail.com (Bruce Weirdan) --000000000000bccdcb062743408b Content-Type: text/plain; charset="UTF-8" > I think it would be a nice feature of PHP's built-in server to do something similar, automatically provide a `$_ENV[APP_ENV]` variable with a value of `development` so that the application logic knows whether it's running on a localhost development environment rather than on a production server. Why couldn't you just do ```php if (php_sapi_name() === 'cli-server') { $_ENV['APP_ENV'] = 'development'; } ``` in your entry point script? -- Best regards, Bruce Weirdan mailto: weirdan@gmail.com --000000000000bccdcb062743408b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
> I think it would be a nice feat= ure of PHP's built-in server to do=20 something similar, automatically provide a `$_ENV[APP_ENV]` variable=20 with a value of `development` so that the application logic knows=20 whether it's running on a localhost development environment rather than= =20 on a production server.

Why couldn't you just = do

```php
if (php_sapi_name() =3D=3D= =3D 'cli-server') {
=C2=A0 =C2=A0 $_ENV['APP_ENV'] =3D &= #39;development';
}
```

in your entry po= int script?

--
=C2=A0 Best regards,=C2=A0 =C2=A0 =C2=A0 Bruce Weirdan=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0=C2=A0 mailto:weirdan@gmail.com
--000000000000bccdcb062743408b--