Apache File Format Handler

NVarg91

New Member
Messages
1
Reaction score
0
Points
0
I need help having PHP executed within html files. This is because it will allow me to format the site a lot easier. On the cPanel X administration page, I can't seem to find the Apache Handler button. It's supposed to be under the advanced tab, but I don't see it. Any help would be appreciated. THANKS.

e.g. code.

<?php
$br = strtolower($_SERVER['HTTP_USER_AGENT']); // what browser they use.

if(ereg("msie", $br)) {
echo "THIS IS IE";
} else {
echo "THIS IS FOR OTHER BROWSER NOT IE";
}
?>

BTW I have intermediate permissions. My friend has the same level of permission and he has that little icon.
 
Last edited:

Scoochi2

New Member
Messages
185
Reaction score
0
Points
0
I need help having PHP executed within html files. This is because it will allow me to format the site a lot easier.
So you want to parse PHP, but from a page with the .html extension?
So your example code might be found in a file called mypage.html then?
If so, read on :)

In the directory you wish to have these PHP enabled files (or at the top www root directory), create a new file called .htaccess

Yes, it does start with a dot! That is important. Call it .htaccess nothing more nothing less.

Edit it, and put the following:
Code:
AddType application/x-httpd-php .html .htm
Save it. All done :)
Now when you run .html or .htm pages, any PHP inside will be run as PHP as if the file was a normal .php file.
 

leafypiggy

Manager of Pens and Office Supplies
Staff member
Messages
3,819
Reaction score
163
Points
63
Code:
AddType application/x-httpd-php .html .htm

WRONG!

on x10 its different:

Code:
AddType application/x-httpd-phpv# .html .htm

where it says phpv#

put either phpv1 phpv2 or phpv3 depending on your php level

Basic = v1
Intermediate = v2
etc

:D
 
Top