Search code examples
phpapacheaddhandler

Apache/PHP add handler will not work for PHP5


My clients host uses PHP4 and 5 and all *.php files run via 5 but when I use this

<FilesMatch "edit.js"> AddHandler application/x-httpd-php .js </FilesMatch>

it runs as PHP 4.4.9 but not on my personal web server (VPS) I need this file.

<FilesMatch "edit.js"> AddHandler application/x-httpd-php5 .js </FilesMatch>

doesn't seem to work just displays source code of PHP.

and help appreciated.


Solution

  • Try

    AddHandler application/x-httpd-php5 .js
                                      ^---
    

    Since, as you say, your host has both PHP 4 and PHP 5, you need to expclitly say which version you want used.