• 13
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

Custom Environment Variables in PHP

Is there a way to set a custom variable such as environment_name in my apache vhost file that can be read via $_ENV or ini_get("environment_name")?

I know if you

SetEnv MY_VAR 1

in your .htaccess file that you'll be able to

echo $_SERVER['MY_VAR']

in your PHP script and/or program. If you can do it in .htacces, you can do it in your vhost configuration.

There's also php functions to set your php ini values.

I'm not sure about a way to populate $ENV, or is SetEnv will do it. It's worth investigating a var_dump($ENV) with the above.

  • 15
Reply Report

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags

Related Questions