Return-Path: Delivered-To: apmail-httpd-users-archive@www.apache.org Received: (qmail 22525 invoked from network); 19 Jan 2006 20:17:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 19 Jan 2006 20:17:37 -0000 Received: (qmail 93601 invoked by uid 500); 19 Jan 2006 20:17:24 -0000 Delivered-To: apmail-httpd-users-archive@httpd.apache.org Received: (qmail 93424 invoked by uid 500); 19 Jan 2006 20:17:23 -0000 Mailing-List: contact users-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: users@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list users@httpd.apache.org Received: (qmail 93413 invoked by uid 99); 19 Jan 2006 20:17:23 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Jan 2006 12:17:23 -0800 X-ASF-Spam-Status: No, hits=0.6 required=10.0 tests=NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [82.153.252.44] (HELO mra04.ch.as12513.net) (82.153.252.44) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Jan 2006 12:17:21 -0800 Received: from localhost (localhost [127.0.0.1]) by mra04.ch.as12513.net (Postfix) with ESMTP id 9AE6AC0449 for ; Thu, 19 Jan 2006 20:17:00 +0000 (GMT) Received: from mra04.ch.as12513.net ([127.0.0.1]) by localhost (mra04.ch.as12513.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 07801-01-34 for ; Thu, 19 Jan 2006 20:17:00 +0000 (GMT) Received: from karsites.net (unknown [81.168.74.150]) by mra04.ch.as12513.net (Postfix) with ESMTP id E5529C033C for ; Thu, 19 Jan 2006 20:16:31 +0000 (GMT) Date: Thu, 19 Jan 2006 20:09:30 +0000 (GMT) From: httpd2@karsites.net X-X-Sender: keith@karsites.net To: users@httpd.apache.org In-Reply-To: Message-ID: References: <43CEED41.4020008@iw.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by Eclipse VIRUSshield at eclipse.net.uk X-Virus-Checked: Checked by ClamAV on apache.org Subject: Re: [users@httpd] Using environment variable in httpd.conf X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Well, I have just found something interesting while reading through Pro Apache 3rd edition, by Peter Wainwright. Apparently, using mod_perl, you can use the full power of the pearl interpreter INSIDE httpd.conf. Quote from the book page 449: "Embedded Perl appears in Apache's configuration inside a ... container, also known as a Perl section. Anything inside this container is executed by mod_perl when Apache starts. You specify configuration directives simply by assigning a package variable of the same name. For example; $ServerAdmin="webmaster@alpha-complex.com"; In Perl, this is a basic assignment of a string to a scalar variable. In a Perl section, it becomes a configuration directive because the variable corresponds to the name of a configuration directive understood by Apache." Peter Wainwright also provides some very capable examples in his book, using this technique. One example of this starts with: ... #Now write the Perl script and embed it into httpd.conf in # a container # generate virtual hosts on the fly with Perl ... ... ... # back to httpd.conf # ...rest of httpd.conf... and, # note the following line calls an external perl interpreter #!/usr/bin/perl -w # rest of Perl script - embedded in htpd.conf # back to httpd.conf #rest of httpd.conf file He concludes this section of the chapter by stating, "Of course you could use any scripting language to create a configuration file this way because Apache no longer needs to know how to interpret it (ie the script) itself." So, in theory (please see disclaimer below - LOL) it should be possible to use an external php interpreter to generate httpd.conf files and configuration directives this way, by embedding the call to the php interpreter into a ... section. The above was extracted from the full sample chapter 7, 'Hosting more than one website', available for download from Apress's website, at: http://www.apress.com/book/supplementDownload.html?bID=275&sID=2134 The download link is not underlined, and is the text 'Download Sample Chapter' which just looks like a sub-heading to me. Pro Apache, Third Edition Download Sample Chapter <-- This is an excellent book, packed with practical explanations of how to master Apache. I have struggled with the online documentation for years. I cannot recommend this book highly enough! HTH Keith In theory, theory and practice are the same; In practice they are not. On Thu, 19 Jan 2006 httpd2@karsites.net wrote: > To: users@httpd.apache.org > From: httpd2@karsites.net > Subject: Re: [users@httpd] Using environment variable in httpd.conf > > > Thanks for the info Joshua. > > I was just curious to know if it was possible to set > variables in httpd.conf . Probably won't need to > use such a feature at the moment. > > Keith > > > In theory, theory and practice are the same; > In practice they are not. > > On Thu, 19 Jan 2006, Joshua Slive wrote: > > > To: users@httpd.apache.org > > From: Joshua Slive > > Subject: Re: [users@httpd] Using environment variable in httpd.conf > > > > On 1/19/06, httpd2@karsites.net wrote: > > > > > > Well Tom, I'm using apache 2.0.50 under SuSE 9.2 pro and > > > just added the following to httpd.conf, after my LoadModule statements: > > > > > > SetEnv ErrLogPath /var/log/apache2/error_log > > > ErrorLog ${ErrLogPath} > > > LogLevel debug > > > > > > All this does for my setup is create an error_log file under > > > /srv/www/ called ${ErrLogPath}. > > > > > > Am I missing something? > > > > The undocumented env-variable-in-config-file feature looks at > > variables in the server environment at time of startup. SetEnv > > doesn't actually make real environment variables until a cgi script is > > launched. See: > > http://httpd.apache.org/docs/2.2/env.html > > > > What you want sounds more like the features provided by mod_macro. > > See http://modules.apache.org/. > > > > But the standard advice in cases like this is: httpd.conf is not a > > programming language, it is a config file. If you need more advanced > > features, then use your favorite preprocess (m4, etc) to generate your > > config files. > > > > Joshua. --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See for more info. To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org " from the digest: users-digest-unsubscribe@httpd.apache.org For additional commands, e-mail: users-help@httpd.apache.org