Getting Apache content types

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joshua Beall

    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


  • Pedro Graca

    #2
    Re: Getting Apache content types

    Joshua Beall wrote:[color=blue]
    > 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?[/color]

    Maybe this?


    --
    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!

    Comment

    • Joshua Beall

      #3
      Re: Getting Apache content types

      "Pedro Graca" <hexkid@dodgeit .com> wrote in message
      news:slrncrhls1 .ln2.hexkid@ID-203069.user.uni-berlin.de...[color=blue]
      > Joshua Beall wrote:[color=green]
      >> 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?[/color]
      >
      > Maybe this?
      > http://www.php.net/mime_content_type[/color]

      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?


      Comment

      • Pedro Graca

        #4
        Re: Getting Apache content types

        Joshua Beall wrote:[color=blue]
        > "Pedro Graca" <hexkid@dodgeit .com> wrote in message
        > news:slrncrhls1 .ln2.hexkid@ID-203069.user.uni-berlin.de...[color=green]
        >> Joshua Beall wrote:[color=darkred]
        >>> Is there a way in PHP to know what all the content-types that Apache
        >>> knows about are?[/color]
        >>
        >> Maybe this?
        >> http://www.php.net/mime_content_type[/color]
        >
        > This appears to get it from a file, called "magic.mime "[/color]

        Oops ...
        PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.

        "This extension has been deprecated ..."
        [color=blue]
        > 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?[/color]

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




        --
        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!

        Comment

        • Hilarion

          #5
          Re: Getting Apache content types

          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


          Comment

          Working...