That method is one of the ways to deal with this issue, though you should note that this ability to use mod_php via a handler is "unsupported", and could be removed by DreamHost at any time.
Because of that, I generally only recommend folks use this method to test if the problem is actually related to PHP-CGI vs mod_php (in this OP's case, it most certainly is!) and, if at all possible, develop a different method of coding to eliminate the dependency on one mode or the other.
For instance, in some circumstances simply changing which environment variable is used will fix a "borken" program so that it will run properly in either mode; other situations may require more work (as in this poster's case).
A couple of alternatives are available to him to make his code work in either php mode These include using a generic authentication module that does not require apache authentication and/or using one of the snippets of workaround code that are available for exactly this purpose (see the comment section of the PHP manual page I linked in my prior response).
Of course, if the "add handler" method works for now, and he is not worried about it suddenly breaking his site should DreamHost make it unavailable, your suggestion is probably the easiest "fix" for his problem.