mfs
mfs

Reputation: 4074

get_browser(); function is not working properly

I am working on PHP 5.4.12 and I was trying to use get_browser(); function. But it is not working at all. I am getting the following error:

"Warning: get_browser(): browscap ini directive not set in C:\wamp\www\myfirstfile.php on line 4"

I first used browscap.ini present on my PC, then download one named php_browscap.ini, but both didn't work.

I am using wamp as my localhost. I set the location of browscap file in php.ini file:

[browscap]
; http://php.net/browscap
;browscap = "C:\wamp\bin\php\php5.4.12\php_browscap.ini"

Still it gives me that error I mentioned above.

My code:

<?php
$browser = get_browser(null,true);
print_r($browser);
?>

Upvotes: 3

Views: 20584

Answers (2)

Iago Le&#227;o
Iago Le&#227;o

Reputation: 214

wget http://browscap.org/stream?q=Lite_PHP_BrowsCapINI -O /etc/php/7.1/mods-available/browscap.ini

Restart your server

Upvotes: 0

Marc B
Marc B

Reputation: 360922

You never enabled the option:

;browscap = "C:\wamp\bin\php\php5.4.12\php_browscap.ini"
^---- comment/disable

Remove the ;.

Upvotes: 12

Related Questions