Get_browser() directive not set

software development

#1

Hello All,

I have a site that needs to use php’s great function that can detect the browser version. get_browser(); What do I have to do to get this working correctly?

Error message:
Warning: get_browser() [function.get-browser]: browscap ini directive not set.

Thanks in advance.


#2

I have a site that needs to use php’s great function that can detect the browser version. get_browser(); What do I have to do to get this working correctly with in my histing account?

Error message:
Warning: get_browser() [function.get-browser]: browscap ini directive not set.

Thanks in advance.


#3

I’m getting this weird feeling of déjà vu.


si-blog | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


#4

Since browser details are client-side information, I’d recommend using javascript since that php function isn’t available. Google is a good resource for this sort of question too.

http://javascript.internet.com/user-details/browser-properties.html
http://javascript.internet.com/user-details/browser-info.html
http://javascript.internet.com/user-details/browser-details.html

http://www.google.com/search?hl=en&q=javascript+get+browser+details&btnG=Google+Search


#5

Thanks for your reply. Actually there is a great universal script, updated almost daily with new browser / client information and a built in PHP function that can be used to get client side information asp or php. I like this better because it works directly with server side scripting and reduces client side scripting (load time). If you need to have it setup on a per site basis use this code.

<?php if (get_cfg_var('browscap')) $browser = get_browser(null, true); //If available, use PHP native function else { require_once($_SERVER['DOCUMENT_ROOT']."/includes/php-local-browscap.php"); $browser=get_browser_local(null, true); } print_r($browser); ?>

More information can be found at this great website.
http://browsers.garykeith.com/downloads.asp


#6

I use Gary’s info - it’s great.

However, in order to use his PHP browscap files you’ll need to compile your own PHP and appropriately change the “browscap=” directive in your php.ini file.


#7

You do not need to compile your own PHP there is a great standalone version. For details follow the information below.

Standalone version of get_browser() in PHP
http://www.php.net/manual/function.get-browser.php
Detection of the capacities of a Web browser client. Requires a compatible browscap.ini database, such as php_browscap.ini on
http://browsers.garykeith.com/downloads.asp