Why my PHP get changed to a comment? -
on webpage view-source:http://cordbloodcenter.com/en/corporate/cord-blood.alej.html
wrote short php code when check source code, php code font green -> change comment.
the php code is:
<?php $myfile = fopen("units.txt", "r") or die("unable open file!"); echo fread($myfile,filesize("units.txt")); fclose($myfile); ?>
why php changed comment? help, -luxqs
the file extension .html
not parsed php interpreter. can simple thing, , change file extension .php
or make php parse .html
files.
go php ini file. @ end find this:
addtype application/x-httpd-php .php
change to:
addtype application/x-httpd-php .php .html .htm
and restart activate it. if use apache command:
httpd -k restart
this quite straightforward. prefer keep .html
, .htm
extension , hide fact using php. why give away more information needed? (not obfuscation way implement security, cannot hurt). don't need make artificial distinction between pure html files , php file.
the downside html files go through php parser, , tiny load on server.
Comments
Post a Comment