简体   繁体   中英

Why wont my browser recognise php scripts within a html file?

I am designing a website that requires me to show the outputs of a mysql database on a webpage written in html. However my browser doesn't seem to recognize the php scripts within the html file and returns blank values where their should be details. The scripts worked fine in the .php files but have no effect when included in the .html files even after creating a .htaccess file as instructed in previously asked questions. Is there anything else that can be done to solve this issue?

There are two methods (that I've encountered) of changing the environment on an Apache server via .htaccess to allow PHP scripts to be processed in .html files, depending on the configuation. Whichever of these you've attempted, try the other.

AddHandler application/x-httpd-php5 .php .html .htm

Or

AddHandler cgi-script .html 
SetEnv PHP_EXTENSION .html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM