Jump to content

[SOLVED] SetEnv VARIABLE value


ignace

Recommended Posts

Hi, I have created a .htaccess file with the following line:

 

SetEnv VARIABLE value

 

in my php script i do:

 

define('VARIABLE', getenv('VARIABLE') ? getenv('VARIABLE') : 'default-value');

 

But this doesn't work it always gives me default-value. I also tried

 

export VARIABLE=value

 

which also doesn't work anyone know how i can get this working on both linux and windows?

Link to comment
Share on other sites

Well i know it is possible because i've seen people do it, they added an environment variable to their os and then launched their script the environment variable was needed to modify the mode (production, development, staging or testing) in which the script was operating and/or it could/couldn't throw errors/exceptions.

 

I was only dumb enough not to ask how they did it as i assumed that just adding it to your environment variable would suffice

Link to comment
Share on other sites

and/or it could/couldn't throw errors/exceptions

 

This would be achieved in your htaccess using the following:

php_flag display_errors off

 

You do not have to set these things in an .htaccess file. You could use a common include file within the application i.e. config.inc.php

<?php
ini_set('display_errors', 'on');
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.