Page 1 of 1

user agent not available on local server?

PostPosted: 23. August 2010 15:05
by morris_buttermaker
Howdy, I have a simple if/else line of php detecting user agent, if it's Firefox on OSX, do this, else do that...

It works fine live but not on my local install of xampp.

I tried this too as a check and live it feeds me back the agent, local nothing.

echo "search for firefox: ==" . stristr($_SERVER['HTTP_USER_AGENT'],"Firefox") . "==";

FYI, my file directory is not in the install location, could that have an affect on it?

Thanks

Re: user agent not available on local server?

PostPosted: 23. August 2010 16:04
by JonB
my file directory


what do you mean by that? Are you referring to the DocumentRoot?

have you examined the Apache access.log?

:shock:

Re: user agent not available on local server?

PostPosted: 23. August 2010 16:28
by morris_buttermaker
Yes, my documentroot was C:\Xampp\htdocs
I switched to D:\Websites

The sites work and php is running, I can do a basic hello world and whatnot, it's just that useragent not showing up locally.

Not at home so I can't check any logs.

Re: user agent not available on local server?

PostPosted: 23. August 2010 17:44
by JonB
Well check those logs -

See if the visits from your machine to localhost are being logged.

IF the access log is correctly reporting the user-agent, then there's proabably a logic flaw somewhere.

It might be a good idea

If there's nothing in the access.log - that's another matter.

Good Luck

Re: user agent not available on local server?

PostPosted: 23. August 2010 17:55
by morris_buttermaker
Asked a guy at work here too and he said check to see if php shorthand is on, I thought I had it on, but maybe not.

Re: user agent not available on local server?

PostPosted: 23. August 2010 20:07
by glitzi85
Better than switching that stupid short_open_tags to on is using the correct format:
Code: Select all
<?php
Code
?>


glitzi