Print View

PHP files return PHP source code as application/x-trash MIME type

Issue

When accessing a PHP web page on Apache 2 the source is returned as a text file with the MIME type of application/x-trash.

Resolution

Apache 2 is using MultiViews to negotiate an unexpected extension for the requested web page using /etc/mime.types e.g.

In /etc/mime.types:

application/x-trash    ~ % bak old sik


In the httpd.conf/apache2.conf:

<Directory /var/www/public_html>
   Options +MultiViews
</Directory>


Will return index.php.old as application/x-trash when /index.php or /index is requested.

References

Products

PHP Hypertext Preprocessor 5
Apache HTTP Server 2

Created: 15th November 2006
Updated: 15th November 2006

Print View

© 2005-2024 Jamie Morrison