> Why couldn't you just do
>
> ```php
> if (php_sapi_name() === 'cli-server') {
>     $_ENV['APP_ENV'] = 'development';
> }
> ```
>
> in your entry point script?

In fact this is pretty much how I currently handle the situation. Of course it can be handled in the entry point script.

My point is, would the built-in server ever be used for anything other than local development? If not, then it would be a simple convenience to developers to have an automatic environment variable of "development" when launching the built-in server. Instead of manually creating this environment variable, it would just be there. Making for a more familiar development environment in comparison to Node environments.

On Nov 19, 2024 1:33 PM, Bruce Weirdan <weir...@gmail.com> wrote:
> 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:weir...@gmail.com

Reply via email to