Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8479179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:57:08+00:00 2026-06-10T18:57:08+00:00

On 2 different AMP servers (one Linux, one Windows), PHP’s finfo function is returning

  • 0

On 2 different AMP servers (one Linux, one Windows), PHP’s finfo function is returning a mime type of “video/mp4” for m4a audio files.

$path = '/path/to/some/audio.m4a';
$finfo = finfo_open(FILEINFO_MIME_TYPE);        
$mime = finfo_file($finfo, $path);
print $mime;  // video/mp4

I believe this can be controlled with Apache’s mime.types file, but after finding the line for “audio/mp4” and adding the m4a extension:

audio/mp4                   mp4a m4a

and restarting Apache, it still reports video/mp4.

How can i get finfo to detect the correct (audio) mime type for .m4a audio files?

TYIA.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T18:57:10+00:00Added an answer on June 10, 2026 at 6:57 pm

    The “magic” file used has nothing to do with Apache. It is used as table of file signatures and is, depending on your system, either a “magic” file distributed with PHP (magic or magic.mime in PHP’s directory, most of the time), or the system’s “magic” file (used by the file command on Unix).

    You can also ask to use a specific “magic” file like this:

    <?php 
      $finfo = new finfo(FILEINFO_MIME, "/usr/share/misc/magic.mgc");
    ?>
    

    You can either change the system’s “magic” file or make your custom one.

    The standard file signatures for MPEG-4 audio and video are:

    00 00 00 18 66 74 79 70
    33 67 70 35     ....ftyp
    3gp5
    MP4     MPEG-4 video files
    
    00 00 00 18 66 74 79 70
    6D 70 34 32     ... ftyp
    mp42
    M4V     MPEG-4 video/QuickTime file
    
    00 00 00 20 66 74 79 70
    4D 34 41 20     ... ftyp
    M4A
    M4A     Apple Lossless Audio Codec file
    

    You may want to check first if these are in your “magic” file.

    From what I remember, m4a (audio) and m4v (video) may have the same mp4 signature (due to bad encoders), so you can’t always differenciate one from the other using the “magic” file. You may then put some PHP code to determine, based on file extension (like Windows does), if it’s video or audio mp4.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 2 different servers: one running Plesk Panel (PHP 5.2.13 & MySQL 5.0.45-community-nt),
I have 3 different jquery uses & put it into one code as follows:
i've got to connect 2 php pages on 2 different servers, in the first
I have multiple instances of Windows services each running in different server. Each one
Is there any difference between type casting & type conversion in c++.
Recently our customers started to complain about poor performance on one of our servers.
hi i'm trying to update two different tables with one trigger but i keep
In my web application (asp.net & vb code), I had two different gridview. Each
We have one server running Windows Server 2003 for our production web server. Our
I'm programming a web socket server in PHP, because I could not find one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.