.htaccess Error : Invalid command 'AuthGroupFile' - php

before this i was working on windows and my project was working proper. recently i moved to ubuntu and i am trying setup project on LAMP.
i have created host for this (windows i was running directly through localhost) and when i am running it getting 500 Internal server Error.
when i looked in my log file i got Invalid command 'AuthGroupFile', perhaps misspelled or defined by a module not included in the server configuration.
.htaccess File
#php_value zend.ze1_compatibility_mode off
AuthName "Restricted Area"
AuthType Basic
AuthUserFile /opt/lampp/htdocs/uniplex_mobile/.htpasswd
AuthGroupFile /dev/null
<Files manageurls.html>
require valid-user
</Files>
<Files addurl.html>
require valid-user
</Files>
<Files editurl.html>
require valid-user
</Files>
AddType application/x-httpd-php .php .htm .html
my project is on smarty framework.
can anyone help to solve this?
Thanks in advance

You can try this.
a2enmod authz_groupfile

Assuming you're using apache 2.2, this means you're missing the mod_authz_groupfile module.
You need to look in your server config and look for the line that contains:
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
or something similar and make sure it's commented out.
Otherwise, just leave out the AuthGroupFile directive, it doesn't look like you're using it anyways.

Related

How to get the REMOTE_USER variable with PHP under linux [duplicate]

Previously I used the IIS server as PHP server. Currently, it is the apache.
On IIS I could access to the variable $_SERVER ['REMOTE_USER'] which returns the username and domain (eg domain\user) but after installing XAMPP this variable is not available.
What I should do to get this variable get again?
My app is on local network with no-internet connection
Finally got it to works! :D
Download the module from here https://www.apachehaus.net/modules/mod_authnz_sspi/ (x86 for 32 bit and x64 for 64 bit apache)
Copy the mod_authnz_sspi.so from Apache24\modules folder and place it in the modules folder of your Apache folder on your webserver
Under the httpd.conf file (Config file for your apache) place this line of code. Try to load this as the last module:
LoadModule authnz_sspi_module modules/mod_authnz_sspi.so
Make sure that the following modules are uncommented
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_core_module modules/mod_authz_core.so
PS: both the above modules are required for this to work.
Place the following code in your httpd.conf file
<Directory "path/to/your/htcdocs/folder">
Options None
AllowOverride All
Order allow,deny
Allow from all
#AuthName "SSPI Protected Place"
AuthType SSPI
SSPIAuth On
SSPIAuthoritative On
SSPIOfferBasic On
SSPIOmitDomain On
Require valid-user
</Directory>
Restart your apache servive and hopefully it should restart without any issues.
Now in order to recognise the user , use the following code on a php page
echo $_SERVER['PHP_AUTH_USER'];
That's all.
I'm using:
XAMPP Control Panel 3.2.1
APACHE 2.4
<Directory "path/to/your/htcdocs/folder">
Options None
AllowOverride All
Order allow,deny
Allow from all
#AuthName "SSPI Protected Place"
AuthType SSPI
SSPIAuth On
SSPIAuthoritative On
SSPIOfferBasic On
SSPIOmitDomain On
Require valid-user
</Directory>
If you use ModRewrite or other I suggest you to keep
Options Indexes FollowSymLinks Includes ExecCGI
otherwise you'll get an error like
[rewrite:error]: Options FollowSymLinks and SymLinksIfOwnerMatch are both off, so the RewriteRule directive is also forbidden due to its similar ability to circumvent directory restrictions
You can only access the remote user if Apache has actually authenticated the user, check the apache auth howto.
I battled with this for a long time, it turned out that I had to install VC redistributable to make it work.

Apache PHP and Rails in subdirectory

I need to setup rails in subdirectory with phusion passenger php being in root directory. I got it working but the rails static files are 404.
The apache config is below:
<DirectoryMatch "^/home/folder_name/public/invite/*">
SetEnv GEM_HOME /home/folder_name/.gems
PassengerEnabled On
PassengerAppRoot /home/folder_name/public/invite
RailsEnv production
PassengerBaseURI /invite
</DirectoryMatch>
<DirectoryMatch "^/home/folder_name/public/invite/public/*">
Allow from all
Options -MultiViews
# Uncomment this if you're on Apache >= 2.4:
#Require all granted
</DirectoryMatch>
Anybody have an idea?
I'm not familiar with DirectoryMatch but it takes a regular expression. which would look more like this:
<DirectoryMatch "^/home/folder_name/public/invite/public/.*">

A requested privilege is not held by client (Apache2 + WebDAV)

This is driving me crazy. I have a Apache2 server with WebDAV enabled on my Debian Wheezy server. I can access it and read from it and it appears to be running correctly.
From my Windows 7 laptop I am running a software called NetDrive2 that mounts a network drive to my WebDAV folder so that I can access it with a drive letter.
Whenever I try to copy files from the Windows 7 laptop to my WebDAV drive, I sometimes get the error message:
Error 0x80070522: A required privilege is not held by the client."
The WebDAV folder has Basic AuthType and I have ofc provided correct user/pass. It is not SSL.
I have done some debugging myself and I am not sure, but it appears that I cannot create a folder that has the same name as a file in the same directory:
Folder:
- file.php
- file/ (cannot create this dir because file.php exists).
Anyone have any ideas? I am stuck!
OK so Googling further I finally found what was causing the problem. I cannot believe this is not mentioned in any tutorials out there.
This guy gave me the answer:
Apache Webdav, unable to create "test" folder when file test.txt exists
Basically, you have to add AllowOverride none, and Options None to your webdav directory.
This is my final configuration for my webdav host in Apache2:
Alias /devshed /home/www/sites/dev
Alias /devsheddav /home/www/sites/dev
<Directory /home/www/sites/dev/>
AllowOverride none
Order allow,deny
Allow from all
Options +Indexes +MultiViews
IndexOptions FancyIndexing
</Directory>
<Location /devshed>
DAV Off
Order allow,deny
Allow from all
AuthName "Pennybridge Devshed Web"
AuthType Basic
AuthUserFile /home/www/htaccess/sites/dev/dev.htpasswd
Require valid-user
</Location>
<Location /devsheddav>
DAV On
Options None
Order allow,deny
Allow from all
AuthName "Pennybridge Devshed WebDAV"
AuthType Basic
AuthUserFile /home/www/htaccess/sites/dev/dev.htpasswd
Require valid-user
php_flag engine off
BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
DirectoryIndex disabled
</Location>

A lock database was not specified with the DAVLockDB directive. One must be specified to use the locking functionality. [500, #401]

I am trying to deploy my maven project website using WebDAV protocal into apache 2.2. Server.
And When I am deploying the application to the server, I am getting above error.
I have following configuration in httpd-dav.conf. but I am still finding above error in ahache_error.log file. Could anybody help me to find the reason here.
DavLockDB "c:/apache2.2/var/DavLock"
Alias /sites "c:/apache2.2/sites"
<Directory "c:/apache2.2/sites">
Dav On
Order Allow,Deny
Allow from all
AuthType Digest
AuthName DAV-upload
Options Indexes
AuthUserFile "c:/wamp/bin/apache/apache2.2.22/user.passwd"
AuthDigestProvider file
# Allow universal read-access, but writes are restricted
# to the admin user.
<LimitExcept GET OPTIONS>
require user admin
</LimitExcept>
</Directory>
Actually I found the answer after 2 days and answer is very simple.
I removed DavLockDB "c:/apache2.2/var/DavLock" from httpd-dav.conf file and
placed this line inside httpd.conf file
This is the only change I did and now I am able to access apache2.2 server using web dav protocal.
Works OK also on Windows.
I have been with the same problem connecting from GoodReader on Ipad to a WebDav on Windows 10 with Laragon.
code C:\laragon\bin\apache\httpd-2.4.35-win64-VC15\conf\httpd.conf
Added the line under WebDAV Apache modules:
LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule dav_lock_module modules/mod_dav_lock.so
DavLockDB "C:/www/webdav/DavLock"

AuthUserFile not specified in the configuration error?

I got an error "AuthUserFile not specified in the configuration" in my error log file. how to fix it.
Here is my .htaccess file, its located in amazon file server.
## mod auth_mysql
AuthBasicAuthoritative Off
AuthMYSQL on
AuthMySQL_Authoritative on
AuthMySQL_DB dbname
Auth_MySQL_Host localhost
Auth_MySQL_User username
Auth_MySQL_Password password
AuthMySQL_Password_Table tbl_name
AuthMySQL_Username_Field user_name
AuthMySQL_Password_Field password
AuthMySQL_Empty_Passwords off
AuthMySQL_Encryption_Types SHA1Sum
# Standard auth stuff
AuthType Basic
AuthName "restricted zone"
Require valid-user
you shall simply put a
AuthUserFile /dev/null
in your .htaccess. That did the trick for me.
for the rest of the pain that brings the configuration of auth_mysql, you have my full comprehension :)
That error isn't refering to your .htaccess but rather the main httpd.conf Apache configuration file. Add that line to your httpd.conf and then restart your httpd service.

Categories