The Apache web server blocks the HTTP_AUTHORIZATION environment variable for CGI apps by default, which is what PHP uses to populate PHP_AUTH_USER/PASS. This behaviour can be turned off by recompiling Apache with the SECURITY_HOLE_PASS_AUTHORIZATION flag set.
The “security hole” is that any other users on a shared server will be able to see the passwords of users authenticating with your site. Whether that's actually a security hole for you depends; often not.
If you are on a cheapo shared server chances are you are not going to get the chance to recompile Apache.
Do you know if it is possible to use a work around similar to here
Yes, it should do, if you have mod_rewrite available. (The caveats about it being potentially a “security hole” still apply.)
It is, however, ugly, and complicates deployment. Also there are a few problems with the example script given (the use of explode discards any : characters in the password, and the echos without proper use of htmlspecialchars() introduce an XSS vulnerability.)
This kind of nonsense is one of the reasons HTTP Authentication is increasingly unpopular. Most sites deploy form/cookie-based auth instead. For an API you would typically have your own token-based auth instead of relying on Basic Authentication.