Page 1 of 1
PHP tags
Posted: Mon Jul 09, 2007 1:11 am
by p4pratik
Hi,
Can I use a php tag in a normal HTML file. By this I mean that the file that will be outputted to browser will be a .html file and not a .php file. However, that html file might comprise some <?php?> tags
Please help!!!
Thanking You in advance,
Kind Regards
Pratik
Posted: Mon Jul 09, 2007 1:27 am
by dibyendrah
Yes you can do that with the apache configuration. If you want to parse PHP tags within the plain html file, you just have to edit configuration file of apache web server.
Just add following line in your httpd.conf file.
Code: Select all
AddType application/x-httpd-php .html
OR
Code: Select all
AddHandler application/x-httpd-php .html
Try any of the above lines.
PHP tags
Posted: Mon Jul 09, 2007 1:48 am
by p4pratik
Hi,
Thank you very much for your immediate response.
I just have to add any 1 of these two lines and get the work done. Is that anything else which i need to do??
Kind Regards
Pratik
PHP tags
Posted: Mon Jul 09, 2007 2:05 am
by p4pratik
Hi Dib,
The solution provided by you worked on my machine. However one doubt.
Since I have apache installed on my machine, I changed the httpd.conf file and things got worked.
But what if I have an ISP who host web sites on an Apache server?
In that case, I will not have any control over the httpd.conf file of the ISP.
I will give the ISP only the pages of my website??
Will that work in that case??
Thanking you in advance
Kind Regards,
Pratik
Posted: Mon Jul 09, 2007 2:39 am
by dibyendrah
That can be done using .htaccess file.
Look for the file named .htaccess in your public_html folder. If it's not there, using text editor and save it as .htaccess
Now add the the following lines:
Code: Select all
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html
This should work !
To learn about .htaccess file, refer to this page :
http://httpd.apache.org/docs/howto/htaccess.html
Best,
Dibyendra
PHP Tags
Posted: Mon Jul 09, 2007 9:31 am
by p4pratik
Hi,
Thank you once again
Kind regards
Pratik