Re: Adding new MIME types for the CLI web server

From: Date: Thu, 31 Oct 2013 21:01:19 +0000
Subject: Re: Adding new MIME types for the CLI web server
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-69986@lists.php.net to get a copy of this message
On 10/25/2013 12:55 PM, Christopher Jones wrote:
I'm planning on adding some MIME type to the CLI web server. For PHP 5.5.5 CLI web server I added the .pdf MIME type. I was using the webserver for a conference exhibition hall demo and needed to present a PDF. Some other multi-media types could be useful in future situations, and in general. I'm thinking of adding these to PHP 5.5.6 & master:
        { "avi",  "video/x-msvideo" },
        { "flv",  "video/x-flv" },
        { "swf",  "application/x-shockwave-flash" },
        { "qt",   "video/quicktime" },
        { "mov",  "video/quicktime" },
        { "mp3",  "audio/mpeg" },
        { "mp4",  "video/mpeg" },
        { "mpg",  "video/mpeg" },
        { "mpeg", "video/mpeg" },
        { "wav",  "audio/wav" },
Notes: - A router can be used to add to, or override, the MIME type lookups, see http://php.net/manual/en/features.commandline.webserver.php - The web server code does a linear lookup through the MIME table, defaulting on failure to returning "application/octet-stream".
I had feedback from one person who suggested adding these:
        { "3gp", "video/3gpp" },    //This is standard video format used for MMS in phones
        { "apk", "application/vnd.android.package-archive" },
        { "avi", "video/x-msvideo" },
        { "bmp", "image/x-ms-bmp" },
        { "csv", "text/comma-separated-values" },
        { "doc", "application/msword" },
        { "docx", "application/msword" },
        { "flac", "audio/flac" },
        { "gz",  "application/x-gzip" },
        { "gzip", "application/x-gzip" },
        { "ics", "text/calendar" },
        { "kml", "application/vnd.google-earth.kml+xml" },
        { "kmz", "application/vnd.google-earth.kmz" },
        { "m4a", "audio/mp4" },
        { "mp3", "audio/mpeg" },
        { "mp4", "video/mp4" },
        { "mpg", "video/mpeg" },
        { "mpeg", "video/mpeg" },
        { "mov", "video/quicktime" },
        { "odp", "application/vnd.oasis.opendocument.presentation" },
        { "ods", "application/vnd.oasis.opendocument.spreadsheet" },
        { "odt", "application/vnd.oasis.opendocument.text" },
        { "oga", "audio/ogg" },
        { "pdf", "application/pdf" },
        { "pptx", "application/vnd.ms-powerpoint" },
        { "pps", "application/vnd.ms-powerpoint" },
        { "qt", "video/quicktime" },
        { "swf", "application/x-shockwave-flash" },
        { "tar", "application/x-tar" },
        { "text", "text/plain" },
        { "tif", "image/tiff" },
        { "wav", "audio/wav" },
        { "wmv", "video/x-ms-wmv" },
        { "xls", "application/vnd.ms-excel" },
        { "xlsx", "application/vnd.ms-excel" },
        { "zip", "application/x-zip-compressed"
The PHP CLI web server 5.5 currrently supports these MIME types natively: { "html", "text/html" }, { "htm", "text/html" }, { "js", "text/javascript" }, { "css", "text/css" }, { "gif", "image/gif" }, { "jpg", "image/jpeg" }, { "jpeg", "image/jpeg" }, { "jpe", "image/jpeg" }, { "png", "image/png" }, { "svg", "image/svg+xml" }, { "txt", "text/plain" }, { "webm", "video/webm" }, { "ogv", "video/ogg" }, { "ogg", "audio/ogg" }, Final comments anyone, before I commit next week? Chris -- christopher.jones@oracle.com http://twitter.com/ghrd Free PHP & Oracle book: http://www.oracle.com/technetwork/topics/php/underground-php-oracle-manual-098250.html

« previous php.internals (#69986) next »