Lively discussions on the graphic arts and publishing — in print or on the web

Go Back   Desktop Publishing Forum > General Discussions > Web Site Building & Maintenance

Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 10-06-2009, 05:36 AM   #1
CarlSeiler's Avatar
Join Date: Oct 2005
Location: Denton, TX
Posts: 276
Default PHP: filemtime with $_SERVER['PHP_SELF']

Originally, I was passing the file date stamp to a php included file using a variable, then I figured there had to be a way to do this, and after a bit of reading came up with the $_SERVER['PHP_SELF'] variable which is supposed to return the currently executing script relative to the document root--which is what I'm trying to get the date for.

So I have the following code:

PHP Code:
$page_year date ("Y"filemtime($_SERVER['PHP_SELF']));
echo (
"   \n");
echo (
"        <div class=\"footer\">\n"); 
echo (
echo (
"<p class=\"note\">Copyright &copy; 1995-");
echo (
echo (
" Leslie Carl Seiler &amp; merseybeasts worldwide.  ");
echo (
"Some rights reserved."); 
echo (
"\n</p><p class=\"note\"><a href=\"about.php\">About merseybeasts.com</a>.</p>\n");
echo (
"<p class=\"note\">  [".$page_fulldate."]</p>\n"); 
echo (
"     </div>"); ?>

And get the following errors:

Warning: filemtime() [function.filemtime]: stat failed for /index.php in /home/beastadmin/domains/merseybeasts.com/public_html/phpincludes/footer.inc on line 2

Warning: filemtime() [function.filemtime]: stat failed for /index.php in /home/beastadmin/domains/merseybeasts.com/public_html/phpincludes/footer.inc on line 3

And the function seems to be returning Dec 31, 1969, which is obviously not correct. I have read up on the "stat failed" bit and it seems that this occurs either when the file whose filename is passed to filemtime does not exist or on 32-bit file systems where the file size of the file is greater than 2Gb. Both of which are not the case here. I suspect that it's not finding /index.php for some reason or another related to its location in the document root, but I don't know why it's having that problem.

[Apologies if this is a dupe. Sysop, feel free to delete.]

Last edited by CarlSeiler; 10-28-2009 at 03:11 AM. Reason: corrected/removed links for lurkers who may find this post later
CarlSeiler is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -8. The time now is 08:15 PM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Contents copyright 2004–2018 Desktop Publishing Forum and its members.