Server Administration
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesServer Administration

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old September 7th, 2003, 02:07 AM
nemesis nemesis is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Saint-Petersburg, Russia
Posts: 29 nemesis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Apache not sending mime-types

Hello

Well, in the beginning everything was almost in its default state:
1) apache was told to put .php files through php.exe by the ScriptAlias, Action, AddHandler directives
2) there was no mime-type specified for .php in httpd.conf
3)php was sending its default text/html.

But then I had a crazy idea that I should have 2 types of php files - one that outputs text/html and the other that generates XHTML content and therefore outputs application/xhtml+xml. And that's where the problems began.
I set the php.ini's default_mimetype to an empty string, so php stopped sending the content-type header. Then i added the following directive to the httpd.conf

AddType application/xhtml+xml .xphp

The problem is that I do not get any content-type header sent. I guess that Apache does not send content-type header in case when a handler was specified (i.e. expects the handler prog will send that header). Am I right? Or I just cannot see my mistake somewhere?

I am running php 4.2.1 as CGI on Apache 1.3.22 on win2000 server.

And just in case I guessed right, could anyone suggest a solution to this type of problem?

Thanks in advance,
Cyril

Reply With Quote
  #2  
Old September 7th, 2003, 01:39 PM
zombie zombie is offline
Codewalkers Intermediate (1500 - 1999 posts)
 
Join Date: Apr 2007
Location: serbia
Posts: 1,876 zombie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: Apache not sending mime-types

first, i suggest not running php as cgi, but as an apache module.

seccond, when apache forwards handling of some file to a cgi or module (like with php files), it doesn't send any content-type headers.

you can send your own headers from php, like so:

header('Content-Type: application/xhtml+xml');



one more note on smth you didn't ask about ;)

IE can't handle this mime type (xhtml), so you should check if web browser accepts xhtml mime type, like so:

php Code:
Original - php Code
  1.  
  2. if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) {
  3.   header("Content-type: application/xhtml+xml");
  4. }


have fun ;)

Reply With Quote
  #3  
Old September 7th, 2003, 03:40 PM
nemesis nemesis is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Saint-Petersburg, Russia
Posts: 29 nemesis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: Apache not sending mime-types

OK. So everything is exactly as I expected. Thanks a lot Zombie. =)

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesServer Administration > Apache not sending mime-types


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway