Docker for PHP application

Kindly help to resolve this error
PHP Version : php:5.4-apache in docker file
APache version :Apache/2.4.6

PHP app:PHP Version 5.4.16


.htaccess: Invalid command ‘EnableBasicAuth’, perhaps misspelled or defined by a module not included in the server configuration

I don’t think that EnableBasicAuth is a valid command in .htaccess. The definitive documentation is Authentication and Authorization - Apache HTTP Server Version 2.4 This article seems to be a decent guide to setting up basic auth.


Nothing seems to work

If you still want help, you need to provide more information than that, although @edgreenberg gave you a perfectly good answer pointing to the right documentation. Why did you think that “EnableBasicAuth” would work in an .htaccess file and why do you think the error is related to Docker?

The only docker-related help I can give you is my HTTPD image. I also have an example how you can enable Basic HTTP auth with that:

docker run --rm -i itsziget/httpd24 /bin/bash -c "htpasswd -nb YOURUSERNAME YOURPASSWORD" >> .htpasswd
docker run -d \
   -v `pwd`/.htpasswd:/usr/local/apache2/.htpasswd \
   --env SRV_AUTH="true" \
   -p 80:80 \

or just generate htpasswd inside the container

docker run -d \
   --env SRV_AUTH="true" \
   --env SRV_AUTH_USERS="admin1 password1\
 admin2 password2"
   -p 80:80 \

Now the access issue is not displayed it prompts the internal server error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at [no address given] to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

THE HTTPD service had issue and that prompts the .ht access issue

Also unless you give us more information for example how exactly you run the container, we can’t help. The error message is just an HTTPD error message and the details are in the logs.

docker logs containername

Here is a blogpost based on my presentation to help you find the logs and find more information about errors.

We can help only if you share what you do.