LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-04-2011, 05:51 AM   #1
grob115
Member
 
Registered: Oct 2005
Posts: 542

Rep: Reputation: 32
Apache: Invalid command 'SetEnvIfNoCase',


Hi, not sure why but Apache is complaining about an error with SetEnvIfNoCase when I tried to start it. I've checked that the module /usr/local/apache2/modules/mod_rewrite.so exists. Also the 2nd code block below shows that I'm using the <IfModule rewrite_module></IfModule> tags so if the module isn't available, Apache shouldn't have read that part of the file. The fact that it's reading inside that tag pair means it's able to load the mod_rewrite.so DSO. Any ideas?

Code:
[root@test httpd-2.2.19]# service httpd restart
Stopping httpd:                                            [FAILED]
Starting httpd: Syntax error on line 203 of /usr/local/apache2/conf/httpd.conf:
Invalid command 'SetEnvIfNoCase', perhaps misspelled or defined by a module not included in the server configuration
                                                           [FAILED]
Line 203 is the following highlighted in bold.
Quote:
<IfModule rewrite_module>
RewriteEngine On
SetEnvIfNoCase Referer "^http://192.168.10.9/" good
<FilesMatch "\.(png|jpg|jpeg|gif|bmp|swf|flv)$">
Order Deny,Allow
Deny from all
Allow from env=good
#ErrorDocument 403 http://www.google.com/intl/en_ALL/images/logo.gif
#ErrorDocument 403 /images/you_bad_hotlinker.gif
ErrorDocument 403 "No hot link allowed"
</FilesMatch>
SetEnvIfNoCase User-Agent "^Wget" malicious_agent
<Limit GET POST>
Order Allow,Deny
Allow from all
Deny from env=malicious_agent
</Limit>
</IfModule>
 
Old 06-04-2011, 06:34 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
This is nothing to do with mod_rerwite you need to make sure the setenvif module is loaded first - http://httpd.apache.org/docs/current..._setenvif.html
 
Old 06-04-2011, 07:51 AM   #3
grob115
Member
 
Registered: Oct 2005
Posts: 542

Original Poster
Rep: Reputation: 32
Hi, thanks. You saved my day. Turns out there were a few more modules I needed to load and they call can be looked up from here based on the Directives being used.
 
Old 06-04-2011, 08:37 AM   #4
grob115
Member
 
Registered: Oct 2005
Posts: 542

Original Poster
Rep: Reputation: 32
Um... something is not adding up. For some reason, I'm now seeing a bunch of the following.
Code:
Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Los_Angeles' for 'PDT/-7.0/DST' instead in [path]/includes/functions.php on line 3461
I have the following setup
Server--------Modules Directory------Configure Command
A---------httpd.exp, libphp5.so------Can't remember
B---------All the modules available--configure --prefix=/usr/local/apache2 --enable-mods-shared=all

The interesting thing is the httpd.conf from Server A works just fine but as soon as I put it into Server B, it complains about all sorts of Directives having issues unless I load the respective modules as we've discovered above. However, once all the modules are loaded, Server B would give me the above timezone setting errors, and also wouldn't know that it should load up the index.php or index.html page on its own.

Is this due to the way Apache was configured? I can't remember what was the command I used to install Apache on Server A but am suspecting that it was without the "--enable-mods-shared=all" option as it doesn't have all the modules.

Last edited by grob115; 06-04-2011 at 09:03 AM.
 
Old 06-04-2011, 08:54 AM   #5
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Los_Angeles' for 'PDT/-7.0/DST' instead in [path]/includes/functions.php on line 3461
This is a php warning. You can edit php.ini and use
Code:
date.timezone = America/Los_Angeles
or whatever timezone you're in.

Regards
 
Old 06-04-2011, 09:05 AM   #6
grob115
Member
 
Registered: Oct 2005
Posts: 542

Original Poster
Rep: Reputation: 32
Thanks. Just recompiled Apache using the following but this time the modules directory only has httpd.exp (ie libphp5.so is missing). Any idea what options would produce just these two files? I'm wondering the difference in behavior might have been due to the way it was configured?
Code:
./configure --prefix=/usr/local/apache2
Also looked at the Apache documentation here. I'm a bit puzzled by the following statement on the page. So what's the point of the "all" keyword?
Quote:
Caveat: --enable-mods-shared=all does not actually build all modules. To build all modules then, one might use:

./configure \
--with-ldap \
--enable-mods-shared="all ssl ldap cache proxy authn_alias mem_cache file_cache authnz_ldap charset_lite dav_lock disk_cache"

Last edited by grob115; 06-04-2011 at 09:23 AM.
 
Old 06-04-2011, 10:16 AM   #7
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
You need to use "--enable-so" if you want to be able to build additional apache modules (like the php module libphp5.so)

Have a look at table 3.3 here to see why you need to explicitly name some modules in the ./configure options

Regards
 
Old 06-04-2011, 10:50 AM   #8
grob115
Member
 
Registered: Oct 2005
Posts: 542

Original Poster
Rep: Reputation: 32
Thanks for the link. Observed the following:
1) The libphp5.so comes from the PHP installation and requires running the PHP's make clean, configure, make, and make install command in order to get it installed into Apache's module directory.
2) After compiling Apache again without the "--enable-mods-shared=all" option, and doing the steps for PHP in step 1 above, the same two files (shown below) I observed before are back. This suggests that Server A initially was built without the "--enable-mods-shared=all" option.
Quote:
[root@test modules]# ls -l
total 22208
-rw-r--r-- 1 root root 9083 Jun 4 07:29 httpd.exp
-rwxr-xr-x 1 root root 22689103 Jun 4 08:10 libphp5.so
With this, executing "service httpd start" I got the following.

Apache was built without "--enable-mods-shared=all" option
Quote:
Starting httpd: httpd: Syntax error on line 87 of /usr/local/apache2/conf/httpd.conf: module setenvif_module is built-in and can't be loaded
[FAILED]
In contrast, the behavior is completely the opposite if I use the "--enable-mods-shared=all" option. This is interesting as initially I also didn't have the "setenvif_module" loaded, and then run into the issue with the Directive "SetEnvIfNoCase", thus starting this thread asking for help.

Apache was built with "--enable-mods-shared=all" option
Quote:
Starting httpd: Syntax error on line 203 of /usr/local/apache2/conf/httpd.conf:
Invalid command 'SetEnvIfNoCase', perhaps misspelled or defined by a module not included in the server configuration
[FAILED]

Last edited by grob115; 06-04-2011 at 11:01 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
invalid command vodka33us Programming 10 01-25-2009 07:54 AM
Apache - I want a timeout for invalid paths Apollo77 Linux - Server 3 11-15-2007 08:48 AM
Apache error - Invalid Command 'AddType'... humbletech99 Linux - Networking 0 11-28-2005 08:22 AM
Apache/tomcat/webapps: Invalid command 'WebAppDeploy' (and WebAppInfo) jeroenvrp Debian 2 10-18-2004 02:07 AM
apache SSI error with Invalid command 'AddOutputFilter' Moebius Linux - Software 2 10-15-2004 12:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration