.htaccess + .htpasswd not working
When I go to the web page it prompts me for a username and password which is good. But when I enter the username and password it pops right back up like it did not recognize it.
I checked the /var/log/httpd/error.log and this is what it says:
MySQL ERROR: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'
MySQL user vern not found: /
Why is it checking MySQL when I am using .htaccess?
And what else might I check?
I set up the file like this: /var/www/html/.htaccess
Changed the permissions to 644
Created the .htpasswd in /var/www/html and also changed permissions to 644
Was not sure but I changed the group and owner to be the same as what runs apache.
You seem to be using a MySQL backend for authentication, and placing the configuration for that inside .htaccess files. .htaccess files can hold other data, and other auth types, not just MySQL. By the output message, I'd say the password database is configured to be looked at and checked by a default user "vern", who MySQL does not know about (eg, doesn't exist in its user database) or is using an incorrect password. Check these pages in your Apache manual (these examples are from 2.2.2, they may be different if your version differs):
Unless you have alot of users, it may be alot easier to use auth basic or auth digest, and put those configs inside the main one and do away with .htaccess altogether. The manual recommends them only if you don't have access to the main server configuration file (as in a hosting environment, for example).
|All times are GMT -5. The time now is 03:41 PM.|