473,797 Members | 3,079 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting Apache content types

Hi All,

Is there a way in PHP to know what all the content-types that Apache knows
about are? Basically, what I want to be able to do is look at an extension,
and then know what content-type Apache would send by default it that file
was requested via HTTP.

Is there a way to do this?

-Josh
Jul 17 '05 #1
4 1836
Joshua Beall wrote:
Is there a way in PHP to know what all the content-types that Apache knows
about are? Basically, what I want to be able to do is look at an extension,
and then know what content-type Apache would send by default it that file
was requested via HTTP.

Is there a way to do this?


Maybe this?
http://www.php.net/mime_content_type

--
Mail to my "From:" address is readable by all at http://www.dodgeit.com/
== ** ## !! ------------------------------------------------ !! ## ** ==
TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
may bypass my spam filter. If it does, I may reply from another address!
Jul 17 '05 #2
"Pedro Graca" <he****@dodgeit .com> wrote in message
news:sl******** ***********@ID-203069.user.uni-berlin.de...
Joshua Beall wrote:
Is there a way in PHP to know what all the content-types that Apache
knows
about are? Basically, what I want to be able to do is look at an
extension,
and then know what content-type Apache would send by default it that file
was requested via HTTP.

Is there a way to do this?


Maybe this?
http://www.php.net/mime_content_type


This appears to get it from a file, called "magic.mime "

This might be what I wind up doing, but I was hoping to get something that
had a 1-to-1 correspondence with how Apache was setup. Unless Apache also
uses magic.mime?
Jul 17 '05 #3
Joshua Beall wrote:
"Pedro Graca" <he****@dodgeit .com> wrote in message
news:sl******** ***********@ID-203069.user.uni-berlin.de...
Joshua Beall wrote:
Is there a way in PHP to know what all the content-types that Apache
knows about are?
Maybe this?
http://www.php.net/mime_content_type


This appears to get it from a file, called "magic.mime "


Oops ...
http://www.php.net/manual/en/ref.mime-magic.php
"This extension has been deprecated ..."
This might be what I wind up doing, but I was hoping to get something that
had a 1-to-1 correspondence with how Apache was setup. Unless Apache also
uses magic.mime?


It appears that Apache falls back on magic.mime if it can't determine
the file type with the mod_mime module.

http://httpd.apache.org/docs/mod/mod_mime.html
http://httpd.apache.org/docs/mod/mod_mime_magic.html

--
Mail to my "From:" address is readable by all at http://www.dodgeit.com/
== ** ## !! ------------------------------------------------ !! ## ** ==
TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
may bypass my spam filter. If it does, I may reply from another address!
Jul 17 '05 #4
I'm not sure what Apache uses, but there's a PHP function 'mime_content_t ype'
which MAY take infos from the same source. Probably this depends on system
platform on which Apache works.

Hilarion
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2106
by: dalyian39 | last post by:
Hello, I'm pretty new to PHP but I have a page, B.php, which runs fine, but I want to be able to call this as B (long story), i.e. http://mysite/B?foo=bar should be equivalent to calling http://mysite/B.php?foo=bar. I've tried creating a symlink on the filesystem B -> B.php but that just sends the text content of the B.php file itself back to the caller. (I kind of thought I'd get away with that =) )
0
1811
by: alexsink | last post by:
I am trying to get apache content negotiation to redirect only zh-CN(mainland China, where Simplified Chinese translations are available) language types to Chinese web pages, and have all other variants of Chinese language tags(ie zh-TW) point to English-suffix pages. Our site currently has content negotiation set up for several other languages, and we have the corresponding html files for those languages being properly served. After...
6
7981
by: MaiyaHolliday | last post by:
Hello, I've recently installed apache on a new computer, and cannot figure out why my site will not process any includes. (it was working on my old one) There are no errors on the page such as "include not found", rather much of the page is blank where the included menus, etc would be, and the CSS is not attached. thanks so much!!! My httpd.conf looks like this:
6
7602
by: josequinonesii | last post by:
I've searched, I've read, I've tested and re-read numerous post but to no avail yet... Quite simply, the settings I've applied to my httpd.conf, httpd-vhost.conf and my hosts files simply does not work. Please review my work and let me know if you see that one little thing that is throwing me for a loop. HTTPD.CONF # # This is the main Apache HTTP server configuration file. It contains the # configuration directives that give the...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10468
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10245
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10021
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9063
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6802
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.