HTTP Basic authentication does not work with fastcgi

HTTP basic authentication fails to work when using the fastcgi configuration,
thus the API does not work. Solution suggested from
https://bugs.php.net/bug.php?id=35752

Testing Done:
Without the patch API calls fail. With the patch API calls succeed.

Reviewed at https://reviews.reviewboard.org/r/4934/
Merge branch 'release-1.7.x'