I installed Zend on my ubuntu homeserver. In my .htaccess file i have the following code:
SetEnv APPLICATION_ENV development
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php [NC,L]
When i echo APPLICATION_ENV in my index.php in the public folder, APPLICATION_ENV is not set.
What am i doing wrong?
Mod rewrite is enabled in apache.
If you are running your home server on a Mac or have suEXEC enabled, there are security measures in place to strip any non-http environment variables that are defined, therefore they won't appear in $_ENV['APPLICATION_ENV']. You CAN, however access these through a PHP function to get the same thing.
$var = apache_getenv('APPLICATION_ENV');
You could even define the environment variable within PHP if you want, although not recommended.
$_ENV['APPLICATION_ENV'] = apache_getenv('APPLICATION_ENV');
I have an almost identical config to what you have, and we just define a global:
define('APPLICATION_ENV', apache_getenv('APPLICATION_ENV'));
Once you do that, it should work as desired.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With