Click to See Complete Forum and Search --> : apache handler for PHP?
amazing_andr3
02-05-2005, 03:59 PM
How do I set the MIME type for .php
application/xhtml+xml
and an appropriate Apache Handler application/x-httpd-php to make the server parse my scripts?
So far it seems doing one of these things will ruin the other. I'm using CPanel. Any ideas?
Server: Apache/1.3.33
PHP/4.3.10
ShrineDesigns
02-05-2005, 08:37 PM
application/x-httpd-php mime type tells apache to send the file to the php engine before it servers it
to set the mime type for a php file after it is parsed by the php engine, you need to do this:<?php
header("Content-type: application/xhtml+xml");
?>
amazing_andr3
02-06-2005, 05:10 AM
Aha. So they are indeed mutually exclusive and I can't do it just by configuring the server, I need to use the header function on every page.
Thanks.
ShrineDesigns
02-06-2005, 11:05 AM
no problem
from my expriences, that is the best way to "force" the content type, meta tags don't really work, because you can set the content type to image/jpeg and it will still render as text/html lol
Stephen Philbin
02-06-2005, 12:21 PM
You can configure the server to send files parsed by the php module to be sent as XNL by just editing the httpd.conf file of your apache server. That way you don't need to add the header function to each and every page you make, however doing so will cause the files to be sent as XML even to that "browser" that doesn't accept it. You would be best (in most situations) to leave the server set to send as text/html and then use the header function of php to send as XML if the connecting user can support it.
ShrineDesigns
02-06-2005, 01:21 PM
Originally posted by Mr Herer
You can configure the server to send files parsed by the php module to be sent as XNL by just editing the httpd.conf file of your apache server. That way you don't need to add the header function to each and every page you make, however doing so will cause the files to be sent as XML even to that "browser" that doesn't accept it. You would be best (in most situations) to leave the server set to send as text/html and then use the header function of php to send as XML if the connecting user can support it.if you change the mime type for php files in httpd.conf, php files would not get parsed by the php engine
eureka, in the php.ini file you can change/set the default mime type for php filesdefault_mimetype = "text/html"
amazing_andr3
02-06-2005, 06:44 PM
yea... unfortunately I don't have direct access to the configuration files, I have to use cPanel. I don't think you can have access to those files unless you run your own server.
ShrineDesigns
02-06-2005, 07:36 PM
the default_mimetype can be set anywhere, for example in a .htaccess filephp_value default_mimetype "application/xhtml+xml"