What means "often" - does it sometimes work? Does HTTP basic authentication work in general on your installation? What webserver setup are you using? Does your PHP run as CGI script? When you are using CGI try the fix presented at http://www.besthostratings.com/articles/http-auth-php-cgi.html
(just the .htaccess part, the other part is already in DokuWiki) and try the latest git version as it has support for the REDIRECT_HTTP_AUTHORIZATION variable.