PDA

View Full Version : hi, is this true? can we do it?


almodcom
11-30-2007, 05:40 PM
hi i have red this article in one of the websites can we use it in our server?

Converting your HTML files to PHP
First, you can simply open up the page you want to use PHP, and run a little test.

Lets open a file called 'index.htm' or something similar. At the very top of the page, before even the <html> tag add this code

<?
echo "Testing that PHP is running ok... success!";
?>

Now we have a page ready to test for PHP... lets add the PHP functionality for your HTML pages.

upload this file as it have this code "AddType application/x-httpd-php .htm .html" it to the root directory of your website, then rename it to '.htaccess'

This tells your website server to look for any .htm or .html pages and treat them as if they where a .php page... all without even renaming your pages!

You don't even have to update your links, all of your .html or .html pages should be able to run PHP now.

Testing for PHP
Now upload the 'index.htm' page that you added the PHP code to (see above) to your website, and open up your web browser (such as Internet Explorer or Opera).

Type in the name of the uploaded index.htm page, for example: www.mydomain.com/index.htm

If PHP is running properly, you should see the message "Testing that PHP is running ok... success!".
thank you

Andan
12-01-2007, 11:35 PM
You can test it.

Use any FTP program and download your current .htaccess file from your public_html folder. Then open up the .htaccess file and add the line "AddType application/x-httpd-php .htm .html" to it (without the double quotes). Save it.

Re-upload the edited .htaccess to your public_html folder. Follow the rest of the instructions in red and test it for yourself.

If it doesn't work or you don't want the functionality, simply remove that single line from your .htaccess file.

Cirtex Andrew
12-13-2007, 09:12 PM
This should work exactly as described without any issue.

cf3752
02-09-2008, 09:04 PM
You can rename the .html extension to .php and it will work also.