get_browser() problem


I would like to use the get_browser() function.

So I downloaded the php_browscap.ini at and pointed to it in my php.ini.

But as soon as I try to use the get_browser() function, i.e.

$browser = get_browser(null, true);

the browser either returns a white page (Opera), downloads the page as empty file (FireFox) or informs me that the connection to the server has been unexpectedly disconnected (Safari).

Any idea what the error could be?


You’ll need to restart the php server so that it can reread the ini file.

Thats not the problem. I have already restarted the server.

The local value for my info.php file shows
browscap /srv/www/vhosts/

You can use phpinfo() to check the current settings for browscap

Does the conf folder have the correct owner and permissions for php to access it?

What do the error logs show for apache and php regarding this?

The apache error log shows:

[Fri Feb 12 15:11:46 2010] [notice] child pid 5643 exit signal Segmentation fault (11)
[Fri Feb 12 15:11:46 2010] [notice] child pid 5700 exit signal Segmentation fault (11)
[Fri Feb 12 15:11:46 2010] [notice] child pid 5701 exit signal Segmentation fault (11)

The php error log does not record anything on this event…?!

The file has following permisions:
-rw-r–r-- 1 myusername psacln 339908 Feb 12 11:56 php_browscap.ini

That type of crash is what used to happen with get_browser when running on PHP3

Hmm, on my server PHP version 5.2.11 is running.

There may-well be a bug relating to the null parameter.
Try feeding it an actual user agent string and see how that goes.