-->

Apache/PHP add handler will not work for PHP5

2019-09-14 23:04发布

问题:

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.

回答1:

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.