faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

71 of 98 people (72%) answered Yes
Recently 8 of 10 people (80%) answered Yes

Entry

Lost Last-Modified when set apache to use PHP4 module for all .htm/.html files. Can one have PHP4 parse .htm/.html and keep the Last-Modified header?

Jan 24th, 2009 09:07
Brad Kint, healthy man, dman, ha mo, Cinley Rodick, Martin Kenny, Jun Liang Chiu, Matt Gregory, Tomaz Borstnar, http://www.ttnr.org


No.  The server actually inserts the last-modified information when you 
use a header.  If you are running the .htm/.html pages through PHP then 
you will not get this information since the server is not reading the 
files, it is getting the results of a script (stdout).
I would not recommend this setup at any rate.  Instead, you should 
use .phtml or .php extensions on your script files and allow 
normal .html files to be handled by the server.  I would put last-
modified into a database and update it when the site is updated.
To include the last-modified information in your PHP scripts, 
you can use the header() function:
<?
  header("Last-Modified: " . gmdate("D, d M Y H:i:s",
filemtime($SCRIPT_FILENAME)) . " GMT");
?>
To make this happen for all your PHP scripts, you can add this to your
auto_prepend_file as specified in the php.ini configuration file.
http://forsakringguide.blogspot.com
http://ghiddeasigurare.blogspot.com
http://guidedelassurance.blogspot.com
http://reiseneuropa1.blogspot.com
http://europadecalatorie.blogspot.com
http://reizeneuropa1.blogspot.com
http://rejsereuropa.blogspot.com
http://consiglibellezza1.blogspot.com
http://www.healthbyhealth.com
http://www.healthment.com
http://www.mesotheliomadown.com
http://www.mesotheliomaout.com
http://www.pickarticle.com