1

I'm running into some trouble figuring out how I should handle something under FastCGI that worked pretty easily under mod_php. Before I was using SetEnv to pass options from my VirtualHost directive to my PHP application. For example:

SetEnv MYAPP_LOGGING_ROOT "/usr/local/myapp/logs"

I was able to access this value from $_SERVER['MYAPP_LOGGING_ROOT'] and it was a pretty convenient way to do manage this. However, this value is not being passed to my PHP application in a FastCGI environment.

I tried the following but it does not appear to be passing all the way down to my PHP application either:

FcgidInitialEnv MYAPP_LOGGING_ROOT "/usr/local/myapp/logs"

Am I missing something simple or do I need to be doing something more complex?

1 Answer 1

2

SetEnv work with mod-fcgid. My config:

    <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
            FCGIWrapper /usr/lib/cgi-bin/php5
            AddHandler fcgid-script .php
            Options ExecCGI Indexes
            SetEnv MYAPP_LOGGING_ROOT "/usr/local/myapp/logs"
    </Directory>

foo.php:

<?php
    var_dump($_SERVER["MYAPP_LOGGING_ROOT"]);
?>

Test:

curl localhost/foo.php 
string(21) "/usr/local/myapp/logs"
1
  • Your answer encouraged me to do some more debugging and found that there was an error elsewhere in my code that was obscuring my original SetEnv command. Mar 2, 2011 at 5:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .