Get_browser() problem

software development

#1

I’m trying to use the get_browser() function in one of my PHP pages – I’m trying to get some specific browser information about my visitors’ browsers.

I’ve had this same script working on another server (not Dreamhost), but I’m having some problems here. I’m getting this error message:

Warning: get_browser(): browscap ini directive not set. in /home/…/folder/stats_functions.php on line 109

I have created a php.ini folder in the same directory as the stats_functions.php and browscap.ini files:

[browscap]
browscap = /home/…/folder/browscap.ini

I’ve checked and double-checked, and I know that I’ve used the correct path here. I’m running PHP4 as an Apache module.

Any suggestions? Anybody else actually been able to get this running on a Dreamhost server?

Thanks.


#2

How is it that you expect your custom php.ini to be loaded by the Apache module? The PHP documentation says that php.ini is loaded by the module when Apache is started, and of course that is going to be DreamHost’s php.ini, not yours. Second, while you can set some settings using .htaccess files for the module, browscap is not one of them. Looks like you’re going to have to switch to running PHP as CGI.

Reference:
Runtime Configuration - The configuration file
Running PHP as an Apache module
List of php.ini directives

:cool: Perl / MySQL / HTML+CSS


#3

I’ve successfully implemented get_browser()/browscap using php.ini on a different server running PHP4 as a Apache module. (Running PHP4 as CGI wasn’t an option on that host). Maybe that was a fluke? I’ll make sure to take a look at the references you suggested to see if I can get this working. Thanks.


#4

Is there a reason get_browser() isn’t set on DH?


#5

Yeah, I’d like to know that one too.


#6

“Anyone who slaps a ‘this page is best viewed with Browser X’ label on a Web page appears to be yearning for the bad old days, before the Web, when you had very little chance of reading a document written on another computer, another word processor, or another network.”
– Tim Berners-Lee in Technology Review, July 1996

http://www.anybrowser.org/campaign/

May have nothing to do with DreamHost’s position, but maybe they’re supporters.

They recently hired more support help.
DreamHost Customers wiki And Forum


#7

A lot of people, myself included, recommend testing for specific functionality rather than browser versions. For instance a check of my browser would return the array with javaapplets set to one, but I have java disabled unless I want to use it for something specific. People also selectively disable things like cookies and javascript regardless of what is defined as supported by their browser.

Just my two cents.

EDIT
Oops, I didn’t realize the OP started this thread over a year ago. Guess it’s irrelevent at this point.
EDIT