473,378 Members | 1,498 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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 1813
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_type'
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
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...
0
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...
6
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...
6
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.