Problems with PHP’s get_browser() on openSUSE 11.2

I just spent way too much time trying to debug PHP’s get_browser() on an openSUSE 11.2 server. All I wanted to do was display a funny little note about what web browser a user was surfing with, as in, “You are using Opera… AWESOME! :-D”, or “You are using Firefox… good :-)”, or even, “You are using IE… that’s sad :-(“.

I had this working just fine on openSUSE 10.3 and openSUSE 11.0, but the 11.2 server was giving me “Default Browser” for any browser I used. I debugged and looked over the configuration/logs again and again, but for some reason it appeared that while get_browser() was seeing the correct php_browscap.ini file, something was going awry.

I finally stopped the debugging process when a Google search landed me on Jonathan Stoppani’s Browscap PHP Project. I made a few minor modifications to my code in order to use his class, and now my browser detection is working great – even on the stubborn openSUSE 11.2 server. Thanks Jonathan!

This entry was posted in Linux, Programming. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *