Php errors
4 posts by 2 authors in: Forums > CMS Builder
Last Post: June 22, 2017 (RSS)
By Kittybiccy - June 21, 2017
I've just received an email saying there is a php error on one of our client sites:
Undefined index: HTTP_USER_AGENT
Please could soemone explain what this means (in simple terms!)? Thanks!
By Dave - June 21, 2017
Hi Kittybiccy,
Is the error in the CMS or on one of the frontend pages?
"Undefine Index" means PHP tried to get a value from an array and it wasn't there. Usually $_SERVER['HTTP_USER_AGENT'] is set to the name of the users browser. Usually something like the following. Your browser sends that with every page request to identify which kind of browser it is.
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
So either the CMS, or a CMS plugin, or one of your frontend pages is trying to access $_SERVER['HTTP_USER_AGENT'] and it's not defined. Maybe because someone's browser isn't sending it or because a script is being run from the server shell such as from a cron job.
You need to figure out which page it's on to further isolate the problem.
interactivetools.com
By Kittybiccy - June 22, 2017
Hi Dave,
The error is in the CMS error log and one certain page. This was the full error:
Jun 21st, 2017 - 06:30:35 AM
E_NOTICE: Undefined index: HTTP_USER_AGENT
/home/linweb44/a/ariaraisland.com-1089953466/user/htdocs/rooms.php (line 188)
http://www.ariaraisland.com/rooms.php
I just want to check that it's not going to cause any issues for the client at all?
By Dave - June 22, 2017
Hi Kittybiccy,
Yea so that variable is being used on /rooms.php somewhere. I'm not sure what it's being used for so I can't be sure. But if you want to hide a PHP error you can do that by adding a @ in front of it, eg: @$_SERVER['HTTP_USER_AGENT']
There might be some custom code on that page that tries to detect the users browser. Likely it will just show an error to end users if you don't hide it. You'd have to take a look to know for sure. It's likely not a big issue at all.
interactivetools.com