Browser setup for PHP

I just tried enabling php_browscap.ini to use the get_browser function.

However, it seems to display an empty array?

$user_agent = get_browser(null, true); print_r($user_agent); 

In my php.ini file, I have the following:

 [browscap] ; http://php.net/browscap browscap = C:/wamp/bin/php/php5.3.0/extra/php_browscap.ini 

I probably missed something simple?

Update

Output:

 Array ( [browser_name_regex] => Β§^.*$Β§ [browser_name_pattern] => * [browser] => Default Browser [version] => 0 [majorver] => 0 [minorver] => 0 [platform] => unknown [alpha] => [beta] => [win16] => [win32] => [win64] => [frames] => 1 [iframes] => [tables] => 1 [cookies] => [backgroundsounds] => [cdf] => [vbscript] => [javaapplets] => [javascript] => [activexcontrols] => [isbanned] => [ismobiledevice] => [issyndicationreader] => [crawler] => [cssversion] => 0 [supportscss] => [aol] => [aolversion] => 0 ) 
+4
source share
2 answers

You can find if something else is not working with tools like ProcMon . This tool will tell you which files were available and what the result was. So you need to open it, select the inercercap ini path, restart the web server and see if any of these scenarios are suitable:

  • The file does not exist
  • Permission denied
  • Finding the wrong way
  • Not displayed at all

ProcMon is a great tool if you're on Windows.

If you find any of these scenarios and don’t know what to do, just edit your question :-)

Good luck

+2
source

There are several php.ini files for WAMP. To get to the right, open it using the WAMP tray icon. This is how I got him to work. As it turned out, in my case, he used one in C: \ Apps \ wamp \ bin \ apache \ apache2.2.22 \ bin.

+1
source

Source: https://habr.com/ru/post/1334762/


All Articles