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".
--
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
Hi,
Christopher Jones wrote:
I'm thinking of adding these to PHP 5.5.6 & master:
{ "mp4", "video/mpeg" },
FYI that's not the correct mime type for mp4 -
http://www.rfc-editor.org/rfc/rfc4337.txt
The exact mime type depends on the content of the file, but
'video/mp4' would be more appropriate than 'video/mpeg'.
cheers
Dan
On Fri, Oct 25, 2013 at 7:55 PM, Christopher Jones
christopher.jones@oracle.com 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.phpThe web server code does a linear lookup through the MIME table,
defaulting on failure to returning "application/octet-stream".--
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
Hi,
Christopher Jones wrote:
I'm thinking of adding these to PHP 5.5.6 & master:
{ "mp4", "video/mpeg" },FYI that's not the correct mime type for mp4 -
http://www.rfc-editor.org/rfc/rfc4337.txtThe exact mime type depends on the content of the file, but
'video/mp4' would be more appropriate than 'video/mpeg'.
My mistake. Thanks for picking it up.
Chris
cheers
DanOn Fri, Oct 25, 2013 at 7:55 PM, Christopher Jones
christopher.jones@oracle.com 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.phpThe web server code does a linear lookup through the MIME table,
defaulting on failure to returning "application/octet-stream".--
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--
--
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
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.phpThe 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
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?
Isn't there a reason why you can't use the fileinfo extension/code for
this instead? Hardcoding it seems rather strange?
cheers,
Derick
--
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug
Posted with an email client that doesn't mangle email: alpine
Isn't there a reason why you can't use the fileinfo extension/code for
this instead? Hardcoding it seems rather strange?
I looked at the manual and mime_content_type()
is deprecated and tells
me to use the Fileinfo PECL extension. From which I am led back to the
parent section, which is for the built-in Fileinfo extension. Looks like
the manual is out-of-date.
Anyhow, looks like finfo_file()
works as we'd want, though I feel uneasy
about guessing filetypes this way. Perhaps we should have several
explicitly specified ones (.txt as text/plain, .html as text/html,
etc.), and guess the rest? Especially for ones which it would not
correctly guess.
Thanks.
Andrea Faulds
http://ajf.me/
Hi!
Final comments anyone, before I commit next week?
It looks strange that we have to hardcode so many mimetypes in the code,
and doesn't sound a scalable solution. Can't we make it use data from
fileinfo or some other customizeable table so we don't have to keep all
MIME types hardcoded in the code? Maybe some ability to use Apache's
mime.types file?
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227
Hi!
Final comments anyone, before I commit next week?
It looks strange that we have to hardcode so many mimetypes in the code,
and doesn't sound a scalable solution. Can't we make it use data from
fileinfo or some other customizeable table so we don't have to keep all
MIME types hardcoded in the code? Maybe some ability to use Apache's
mime.types file?
It isn't scalable, but users can always use a router script to add
additional types so there isn't a real world problem in missing
uncommon extensions.
My idea was to add common extensions to the existing look-up list. A
quick and straight-forward solution to making the CLI web-server
handle the 80-20 rule.
If someone (ajf?) wants to work on a more comprehensive solution
instead, I have no objection.
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
Chris,
What is wrong with a more common magic file which fileinfo utilizes? I
understand the concept of adding common extensions but only as a fallback
to distro behavior.
Regards,
Mike
On Oct 31, 2013 6:52 PM, "Christopher Jones" christopher.jones@oracle.com
wrote:
Hi!
Final comments anyone, before I commit next week?
It looks strange that we have to hardcode so many mimetypes in the code,
and doesn't sound a scalable solution. Can't we make it use data from
fileinfo or some other customizeable table so we don't have to keep all
MIME types hardcoded in the code? Maybe some ability to use Apache's
mime.types file?It isn't scalable, but users can always use a router script to add
additional types so there isn't a real world problem in missing
uncommon extensions.My idea was to add common extensions to the existing look-up list. A
quick and straight-forward solution to making the CLI web-server
handle the 80-20 rule.If someone (ajf?) wants to work on a more comprehensive solution
instead, I have no objection.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
Chris,
What is wrong with a more common magic file which fileinfo utilizes? I
understand the concept of adding common extensions but only as a fallback
to distro behavior.Regards,
Mike
There's nothing wrong that I know of. If you have time to implement it,
go ahead.
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
hi,
On Sat, Nov 23, 2013 at 5:39 AM, Christopher Jones
christopher.jones@oracle.com wrote:
Chris,
What is wrong with a more common magic file which fileinfo utilizes? I
understand the concept of adding common extensions but only as a fallback
to distro behavior.Regards,
Mike
There's nothing wrong that I know of. If you have time to implement it,
go ahead.
There is nothing wrong but it may not as easy as it looks.
This file must be available when fiinfo is not enabled (build time) or
loaded. fileinfo ma be shared too (as far as I remember almost all
distros provide it optionally and shared). That's something to keep in
mind while implementing a patch.
Cheers,
Pierre
@pierrejoye | http://www.libgd.org