Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
06-04-2011, 06:51 AM
|
#1
|
Member
Registered: Oct 2005
Posts: 542
Rep:
|
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>
|
|
|
|
06-04-2011, 07:34 AM
|
#2
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
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
|
|
|
06-04-2011, 08:51 AM
|
#3
|
Member
Registered: Oct 2005
Posts: 542
Original Poster
Rep:
|
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.
|
|
|
06-04-2011, 09:37 AM
|
#4
|
Member
Registered: Oct 2005
Posts: 542
Original Poster
Rep:
|
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 10:03 AM.
|
|
|
06-04-2011, 09:54 AM
|
#5
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,217
|
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
|
|
|
06-04-2011, 10:05 AM
|
#6
|
Member
Registered: Oct 2005
Posts: 542
Original Poster
Rep:
|
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 10:23 AM.
|
|
|
06-04-2011, 11:16 AM
|
#7
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,217
|
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
|
|
|
06-04-2011, 11:50 AM
|
#8
|
Member
Registered: Oct 2005
Posts: 542
Original Poster
Rep:
|
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 12:01 PM.
|
|
|
All times are GMT -5. The time now is 03:30 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|