IIS, Apache, and header()
I'm working on migrating a website from an external server (running Apache) to a local server (running IIS), and have come across an issue that I can't seem to resolve.
The site is using a custom Joomla plugin that grabs some graphics stored in a mysql database (for e.g. http://www.norfolktourism.ca/index.php?option=com_bdirectory&task=image&cid=191). However, when I migrate the site to the local server, the images are broken.
Upon further exploration, I've discovered that somehow, when ra开发者_JAVA技巧n on the local server, their seems to be whitespace (as in a new line) that gets processed before the header() function is processed, hence breaking the image (however, I don't get an error - just a broken image).
I'm absolutely baffled as to what the issue may be, as the code works fine on the external Apache server.
Would anyone have any suggestions on possible resolutions?
Difficult to say, and the scenario is not clear. The external Apache server runs on Linux or Windows ? May be some bug related with newlines?
Update: For example, for debugging, you could run this and compare with the output (for the same image) in your IIS server:
[root@server1 tmp]# wget -S -O imgunix.jpg 'http://www.norfolktourism.ca/index.php?option=com_bdirectory&task=image&cid=191'
HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Date: Wed, 09 Jun 2010 15:18:21 GMT
Server: Apache
Content-Length: 4406
Content-Disposition: filename="health.jpg"
Content-Type: image/jpeg
Length: 4406 (4.3K) [image/jpeg]
[root@server1 tmp]# od -c imgunix.jpg | head 0000000 377 330 377 340 \0 020 J F I F \0 001 002 \0 \0 d
0000020 \0 d \0 \0 377 354 \0 021 D u c k y \0 001 \0
0000040 004 \0 \0 \0 < \0 \0 377 356 \0 016 A d o b e
0000060 \0 d 300 \0 \0 \0 001 377 333 \0 204 \0 006 004 004 004
精彩评论