Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

7amoood
Copy link
Contributor

@7amoood 7amoood commented Oct 4, 2025

… variables are accessible

This PR updates the bootstrap file to use getenv() instead of $_ENV when retrieving environment variables.

In some PHP configurations, $_ENV returns null unless the variables_order setting in php.ini includes the E flag. This can cause Octane to fail when resolving the application base path or vendor directory.

By switching to getenv(), Octane can reliably fetch environment variables without requiring users to modify their PHP configuration.

Changes

  • Replaced $_ENV['APP_RUNNING_IN_CONSOLE'] with getenv('APP_RUNNING_IN_CONSOLE').
  • Ensured COMPOSER_VENDOR_DIR and other variables are resolved consistently.

Why

When extending the Swoole server start process and attempting to change the vendor file path, $_ENV returned null unless variables_order was explicitly configured. This fix ensures smoother setup for developers across different environments.

Impact

  • No breaking changes.
  • Improves reliability of environment variable handling in Swoole/Octane bootstrap.

… variables are accessible

This PR updates the `bootstrap` file to use `getenv()` instead of `$_ENV` when retrieving environment variables.

In some PHP configurations, `$_ENV` returns `null` unless the `variables_order` setting in `php.ini` includes the `E` flag. This can cause Octane to fail when resolving the application base path or vendor directory.

By switching to `getenv()`, Octane can reliably fetch environment variables without requiring users to modify their PHP configuration.

### Changes
- Replaced `$_ENV['APP_RUNNING_IN_CONSOLE']` with `getenv('APP_RUNNING_IN_CONSOLE')`.
- Ensured `COMPOSER_VENDOR_DIR` and other variables are resolved consistently.

### Why
When extending the Swoole server start process and attempting to change the vendor file path, `$_ENV` returned `null` unless `variables_order` was explicitly configured. This fix ensures smoother setup for developers across different environments.

### Impact
- No breaking changes.
- Improves reliability of environment variable handling in Swoole/Octane bootstrap.
@7amoood 7amoood closed this Oct 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant