mattward Posted August 6, 2013 Share Posted August 6, 2013 I have a php page that checks a user's browser, and if they are using any version of IE earlier than 9.0, it tells them they must use a different browser to access the page they are trying to get to. If their browser is compatible, it just passes them right along to the destination site. The code works perfectly in my WAMP testing environment, but when I put it on our LAMP server, it doesn't pull the browser info. Consequently, it passes the user on to the destination site, even if their browser is not compatible. I have configured my php.ini file to point to the correct path for my php_browscap file, and when I look at the php test page, it shows the correct location in the browscap value setting. Any ideas as to why this would not be working on the LAMP server? Or any ideas on a better way to accomplish what I am trying to do here? I am always open to better ideas. Here is the code: ------------------------------------------------------------------ <?php $browser = get_browser(NULL, TRUE); if($browser["browser"] == 'IE' AND $browser["version"] < 9) { echo "Your current internet browser is Internet Explorer Version " . $browser["version"] . ". "; echo "In order to use this website, you must either use Google Chrome, Mozilla Firefox, or Internet Explorer 9.0 or higher."; } else { header("Location: http://myURL"); } ?> <html> <p><a href = "http://www.microsoft.com/ie">Click here to install a current version of Internet Explorer</h></p> <p><a href = "http://www.mozilla.com/firefox">Click here to install Mozilla Firefox</h></p> <p><a href = "http://www.google.com/chrome">Click here to install Google Chrome</h></p> </html> -------------------------------------------------------------------- Thanks in advance for any insights! Quote Link to comment https://forums.phpfreaks.com/topic/280899-get_browser-working-in-wamp-but-not-in-lamp/ Share on other sites More sharing options...
jazzman1 Posted August 6, 2013 Share Posted August 6, 2013 I think, that's not a server side issue. Check the php versions, also I would recommend to do this in JavaScript. Quote Link to comment https://forums.phpfreaks.com/topic/280899-get_browser-working-in-wamp-but-not-in-lamp/#findComment-1443711 Share on other sites More sharing options...
mattward Posted August 6, 2013 Author Share Posted August 6, 2013 What is the advantage to doing this with JavaScript over PHP? Quote Link to comment https://forums.phpfreaks.com/topic/280899-get_browser-working-in-wamp-but-not-in-lamp/#findComment-1443729 Share on other sites More sharing options...
jazzman1 Posted August 6, 2013 Share Posted August 6, 2013 What is the advantage to doing this with JavaScript over PHP? Resources. Quote Link to comment https://forums.phpfreaks.com/topic/280899-get_browser-working-in-wamp-but-not-in-lamp/#findComment-1443755 Share on other sites More sharing options...
mattward Posted August 7, 2013 Author Share Posted August 7, 2013 Made it work with Javascript. I found a really useful script here that worked like a charm. Thanks for your response! Quote Link to comment https://forums.phpfreaks.com/topic/280899-get_browser-working-in-wamp-but-not-in-lamp/#findComment-1443885 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.