browsecap-get-browser https___ipfail-org_tools_index.php
  • Do you want to use the function: get_browser in php and the result of the function is empty?
  • Using the get_browser function generates error messages ?:
    Got error 'PHP message: PHP Warning: get_browser(): browscap ini directive not set in .../ on line ...'
  • Trying to activate the option in php.ini generates fatal or warnings errors ?:
    ... NOTICE: PHP message: PHP Warning: Cannot open 'extra/browscap.ini' for reading in Unknown on line 0
    ... NOTICE: PHP message: PHP Fatal error: Unable to start standard module in Unknown on line 0
  • The function does not correctly recognize modern browsers?

Then I think you need to update the browscap.ini file or “install” this file on the server if it does not exist!

Here are the steps needed to solve this “problems” in ubuntu / debian server:

1). Locate the folder where php is installed

is usually in /etc/php/ and the functional version, in my case is in /etc/php/7.4/

But they can be found using the following commands in ubuntu server (in my case, ubuntu 20.04):

@ php -version

PHP 7.4.13 (cli) (built: Nov 28 2020 06:24:59) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.13, Copyright (c), by Zend Technologies
@ php -a
Interactive mode enabled

php > phpinfo();
PHP Version => 7.4.13

System => Linux *** 5.4.0-1009-kvm #9-Ubuntu SMP Mon Apr 20 20:23:56 UTC 2020 x86_64
Build Date => Nov 28 2020 06:24:59
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /etc/php/7.4/cli
Loaded Configuration File => /etc/php/7.4/cli/php.ini
Scan this dir for additional .ini files => /etc/php/7.4/cli/conf.d
Additional .ini files parsed => /etc/php/7.4/cli/conf.d/10-mysqlnd.ini,

From the displayed results we deduce that the active version for the installed php configuration is in the folder /etc/php/7.4/

2). Install the browscap.ini file

It is useful to install it in the folder /etc/php/7.4/mods-available

You must first download an updated version from, only the special version of browscap.ini for PHP users only!:

@ sudo wget

php-browscapini etc_php_7.4_mods-available-Ubuntu-linux

and rename the saved PHP_BrowsCapINI file as follows:

@ sudo mv 'stream?q=PHP_BrowsCapINI' browscap.ini

Ubunt-Linux-etc_php-7-4_mods-available browscap

3) Enable the [browscap] option in the php.ini,

in my case located in the folder /etc/php/7.4/fpm/

@ sudo nano /etc/php/7.4/fpm/php.ini

modify the file as follows:

;browscap = extra/browscap.ini
browscap = /etc/php/7.4/mods-available/browscap.ini

Save the change and restart the php service:

@ sudo service php7.4-fpm restart

or possibly restart the entire web-stak as follows:

for Apache:

@sudo apache2ctl restart

or if you use Nginx:

@sudo nginx -s reload

That was all, Happy Coding !

Tags: , , , ,

One Comment

  1. […] valid User-Agent browser , otherwise some sites restrict […]

Leave a Reply

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