• TechOps

    Need clarity?
    Chat with our experts now

    • Web Hosting SupportWeb Hosting Support
    • Helpdesk Support

      Skilled and professional 24/7 helpdesk support

    • Product Support

      Boost your product support with our expertise

    • Managed ServicesManaged Services
    • Server Management

      Don't let server issues slow you down. Let us manage them for you

    • Server Monitoring

      Safeguard your server health with our comprehensive monitoring solutions

    • Staff AugmentationStaff Augmentation
    • Hire an Admin

      Transform your business operations with our expert administrative support

    • Hire a Team

      Augment your workforce with highly skilled professional from our diverse talent pool

  • CloudOps

    Confused?
    Discuss with our sales team now.

    • Author ProfileAWS
      Well Architected Review
    • Author ProfileFinOps As a Service

      FinOps As a Service

    • Migrate

      Upgrade the journey: Migrate & Modernize seamlessly

    • Modernize

      Effortless CloudOps mastery for seamless cloud management

    • Optimize

      Efficient CloudOps: Boosting performance through optimization

    • Manage

      Simplify compliance complexities with our dedicated service

  • DevOps

    How Supportsages
    is creating an
    impact?

    View Casestudies
    • Author Profile24/7 DevOps As a Service

      Round-the-clock DevOps for uninterrupted efficiency

    • Author ProfileCI/CD Pipeline

      Automated CI/CD pipeline for seamless deployments

    • Author ProfileInfrastructure As a Code

      Crafting infrastructure with ingenious code

    • Author ProfileDevSecOps

      Integrated security in continuous DevOps practices

    • Author ProfileHire DevOps Engineers

      Level up your team with DevOps visionaries

    • Author ProfileConsulting Services

      Navigate success with expert DevOps consulting

  • SecOps

    Expert SecOps Services
    for any Scale

    • Author ProfileVAPT

      Vulnerability Assessment and Penetration Testing

    • Author ProfileSource Code Review

      Ensuring source code security and safe practices to reduce risks

    • Author ProfileSecurity Consultation

      On demand services for improving server security

    • Author ProfileSystem Hardening

      Reduced vulnerability and proactive protection

    • Author ProfileManaged SOC

      Monitors and maintains system security. Quick response on incidents

    • Author ProfileCompliance as a Service

      Regulatory compliance, reduced risk

  • Insights

    Explore our latest
    insights and resources

    Blog

    Explore our latest articles and insights

    Case Studies

    Read about our client success stories

  • Contact Us

  • About
  • Certifications
  • Life at Supportsages
  • Events
  • Contact
  • Careers
  • Blog

  • Dedicated Support Team
  • Quasi-dedicated Support Team
  • Hire a DevOps Engineer
  • Hire a Billing Support Staff
  • Per-ticket Support Plan
  • Managed Services

  • Microsoft Azure Expert
  • AWS Cloud Expert
  • Hire a developer
SS

SupportSages

Bites of wisdom @ work


Copyright © 2008 - 2026 SupportSages Pvt Ltd. All Rights Reserved.
Privacy PolicyLegal TermsData ProtectionCookie Policy

Enabling Browscap extension to PHP (Cloud Linux Environment)

Vipin R.N

  • 4 min read
Enabling Browscap extension to PHP (Cloud Linux Environment)

Generating audio, please wait...

The Client was trying to get Browser information of his site visitors using get_browser() function, but it didn’t work. Let us see how to fix the issue with browscap php extension

Browscap :

Browser Capabilities Project. Used to obtain Browser information and related statistics of Visitors to a website. The Native code used for this is :

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

Browscap is an advanced extension of HTTP Environment Variable HTTP_USER_AGENT

Background Information
The issue was with the Browscap PHP extension. It was not available in the server. The server is running on CloudLinux, so things are quite different here in terms of PHP. CloudLinux has several features, PHP Selector is one among it. With the aid of PHP Selector, cPanel users can switch to PHP versions 5.2, 5.3, 5.4, 5.5 and other (native) versions if included in its configuration. Hence, the native location for PHP (in cPanel servers) at /usr/local/lib/php is not used in CloudLinux environment.

CloudLinux

A smart range of Installation / Configuration docs are available here as well.

Prelude
With reference to this topic it is possible to compile PHP extensions as we prefer. But Browscap PHP extension is not actually an extension that has to be configured. The library files were already available, we just had to know how to include it in the PHP configuration.

Following are the important file locations in CloudLinux environment for PHP :

File Location
PHP 5.x /opt/alt/php5x/
PHP 5.x Binary files /opt/alt/php5x/usr/bin/
PHP 5.x Binary (CLI) /opt/alt/php5x/usr/bin/php
PHP 5.x Binary (CGI)  /opt/alt/php5x/usr/bin/php-cgi
 PHP 5.x Configuration  /opt/alt/php5x/etc/php.ini
PHP 5.x Configuration (Extensions)  /opt/alt/php52/etc/php.d.all/
PHP 5.x Modules /opt/alt/php5X/usr/lib64/php/modules/

 

* Replace x with appropriate version, for instance php52/php53/php54

Fix
The fix is quite simple. Download the Browscap configuration file from here and move it to /opt/alt/php5x/etc/php.d.all. Further edit the PHP configuration file /opt/alt/php5x/etc/php.ini and uncomment the following line :

[browscap]

;browscap = extra/browscap.ini

to

[browscap]

browscap = /opt/alt/php5x/etc/php.d.all/browscap.ini

Save the file. Please note that you will have to do this for all PHP versions if it has to be made available globally.

Finally, restart CageFS parameters :

cagefsctl --rebuild-alt-php-ini

cagefsctl --force-update 

Test the PHP Code given earlier, it should give you the output like this

Detecing Browser … stdClass Object ( [browser_name_regex] => ^mozilla/5\.0 (.*linux i686.*).*gecko/.*firefox/.*$ [browser_name_pattern] => Mozilla/5.0 (*Linux i686*)*Gecko/*Firefox/* [parent] => Firefox Generic [platform] => Linux [win32] => [comment] => Firefox Generic [browser] => Firefox [alpha] => 1 [frames] => 1 [iframes] => 1 [tables] => 1 [cookies] => 1

=> 1 [javaapplets] => 1 [cssversion] => 3 [version] => 0.0 [majorver] => 0 [minorver] => 0 [platform_version] => unknown [beta] => [win16] => [win64] => [backgroundsounds] => [vbscript] => [activexcontrols] => [ismobiledevice] => [issyndicationreader] => [crawler] => [aolversion] => 0 )

 

  • Howtos
  • Linux

Looking for AWS Experts?

We provide top-of-the-line custom AWS setup services tailored to your needs.

“Suspended Page ” defaced in cPanel Server

“Suspended Page ” defaced in cPanel Server
  • cPanel
  • Linux
  • Troubleshooting
logo

APC Cache Activation and disable XCache

APC Cache Activation and disable XCache
  • Apache
  • cPanel
  • Linux
logo

Blacklisted ? Switch your Mail Server IP

Blacklisted ? Switch your Mail Server IP
  • cPanel
  • Linux
  • Webmail
logo

Chapter 12 All about a process running in linux

Chapter 12 All about a process running in linux
  • General
  • Howtos
  • Linux
  • Special Offers
  • Training
  • Troubleshooting
logo
Enabling Browscap extension to PHP (Cloud Linux Environment)

Posts by Vipin R.N

Vipin is a no-nonsense, disciplined guy who ensures that everything is carried out with the highest level of perfection. Apart from his great coding skills, he is quite interested in advanced server administration, issue analysis, documentation and training. In-depth knowledge in international politics, ammunition and automobiles makes this hard core Manchester United fan, one of the most referenced personalities in the entire team.