Re: Better development streamlining of the built-in server

From: Date: Tue, 19 Nov 2024 12:52:23 +0000
Subject: Re: Better development streamlining of the built-in server
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-125989@lists.php.net to get a copy of this message
> 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 <weirdan@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 ``phpif (php_sapi_name() === 'cli-server') {    $_ENV['APP_ENV'] = 'development';}`` in your entry point script?--   Best regards,      Bruce Weirdan                                     mailto:weirdan@gmail.com

« previous php.internals (#125989) next »