Fileinfo

From DreamHost
Jump to: navigation, search

Overview

The functions in the fileinfo module try to guess the content type and encoding of a file by looking for certain magic byte sequences at specific positions within the file. While this is not a bullet proof approach, the heuristics used do a very good job.

You can find more information about fileinfo at php.net – File Information.

The instructions provided in this article or section are considered advanced.

You are expected to be knowledgeable in the UNIX shell.
Support for these instructions is not available from DreamHost tech support.
Server changes performed by DreamHost may break your modifications. You, as the user, are responsible for troubleshooting and resolving issues with your customizations.

Enabling fileinfo

  1. Create a phprc file under your username. View the PHP.ini article for further details.
  2. Once you’ve created your phprc file, add the following line to it:
    extension = fileinfo.so
  3. Save your phprc file and restart php. View the killing php processes article for details.
  4. Check to see if your changes have updated.
  5. Add a new file to your website titled phpinfo.php and include the following code:
    <?php
    phpinfo();
    ?>
    
  6. View the following URL in your browser:
    example.com/phpinfo.php
    You should see the following in the page that appears:
    01 fileinfo.png

See also