httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bo Berglund <>
Subject [users@httpd] File renders differently when opened through Apache or direct, why?
Date Sat, 11 May 2013 08:58:49 GMT
I have a PHP logging script, which produces a file on the server in a
logging directory. In order to make the file easier to read through a
browser I have made the PHP script create each log line as a table row
in a table. I let the script write the file header when the logfile is
created as follows:
<table border="1"><tr>
<th align="left">Timestamp</th>
<th align="left">Username</th>
<th align="left">IP address</th>
<th align="left">hostname</th>
<th align="left">Page accessed</th>
<th align="left">Referring page</th>
<th align="left">Servername</th></tr>

Then for each access I append one line with info like the following
example from my test server (it is actually on a single line, but for
easier reading here I have cut it into lines for each column in the

<tr><td>2013-05-11 10:40:14</td>
<td>Unknown User</td>

Now I wanted to look at the logfile via my webserver so I entered the
local URL (<myservername><sitename>/logs/testpage2013-05.log) into
FireFox and what was shown was the above *source* text rather than the
expected table!
But if I open the exact same file directly in FireFox, bypassing
Apache, then the table displays as intended!
Why is this happening?

I know that the file is open ended such that it lacks the closing
</table></body></html> tags but that seems not to be a problem when
viewing the file as a file:// URL in FireFox, so why does it happen
through Apache?

Bo Berglund
Developer in Sweden

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message