Welcome to WebmasterWorld Guest from 18.206.168.65

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

function.filemtime?

     
12:40 am on Mar 11, 2010 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 2, 2005
posts:505
votes: 0


I ran Xenu link sleuth on my website today, and one of the 404 errors reported were:

http://www.example.com/function.filemtime


When I went to the affected page, function.filemtime was nowhere in the source, or linked anywhere.

I have seen this error once before, but I do not recall what caused it. It only showed up on 2 files; files of which are place-holders for nearly 5,000 other pages. If this were an actual 'problem', it would show for the other 5k, wouldn't it?


Any insights on to how I can figure out what triggered this?
8:15 am on Mar 11, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:Dec 13, 2009
posts:945
votes: 0


When you have an error, you will often find that an error message get's stuck at the top of the page. If it's a function error it will, for some reason, have the function that triggered the error as a link to example.com/function.name
9:50 am on Mar 11, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 24, 2005
posts:697
votes: 0


Failed Code Injection attempt?
1:30 pm on Mar 11, 2010 (gmt 0)

Senior Member from KZ 

WebmasterWorld Senior Member lammert is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 10, 2005
posts: 2947
votes: 30


The function.filemtime error is a runtime error of PHP. You won't see it in your source, but it is only generated when PHP parses your scripts. It is probably caused by a call to the PHP filemtime() function somewhere in your scripts which returns the modification time of a file. If that file doesn't exist or cannot be accessed due to permission settings, PHP will generate a runtime error to the browser window. This runtime error seems to be picked up by the Xenu link checker.
2:32 am on Mar 12, 2010 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 2, 2005
posts:505
votes: 0


I ran the Xenu scan a few times afterward and haven't gotten it in any of the later scans.


However, upon inspecting error_log -- I get a bunch of these:
[11-Mar-2010 20:22:55] PHP Warning: filemtime() [<a href='function.filemtime'>function.filemtime</a>]: stat failed for /home/**/public_html/cache/index.php_path=22__.cache in /home/**/public_html/includes/cache.php on line 330


On line 330:
 if ( ( filemtime($filename) + $this->cache_lifetime) < time() )


As this is part of my cache function, I assume removing it would cause issues with my caching.

I suspect this error is being generated when a visitor clicks a page whose cache file was recently removed, but the content simply reloads beneath.. so this error is obsolete by the time someone clicks it. Can I suppress it without killing the rest of my php errors? (I use them for troubleshooting other scripts, but this error just baffles me.)
2:58 am on Mar 12, 2010 (gmt 0)

Senior Member from KZ 

WebmasterWorld Senior Member lammert is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 10, 2005
posts: 2947
votes: 30


You can switch off all warning messages during the processing:

$old_mask = error_reporting( 0 );

if ( ( filemtime($filename) ... ) {
}

error_reporting( $old_mask );
3:52 am on Mar 12, 2010 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 2, 2005
posts:505
votes: 0


Added that into the file. Not sure how to test it, since I can't reproduce the error, but I wiped error_log.

My last error showed at:
[11-Mar-2010 22:00:53]

Hopefully this works. Thanks for the tip so far. :)
8:54 am on Mar 14, 2010 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 2, 2005
posts:505
votes: 0


New update:
Cache is working fine and no function.filemtime errors in error_log OR with Xenu.

Thanks a ton, lammert!
1:58 pm on Mar 14, 2010 (gmt 0)

Senior Member from KZ 

WebmasterWorld Senior Member lammert is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 10, 2005
posts: 2947
votes: 30


Just note that this solution doesn't solve the problem of your non-existent files, it only masks the errors which are generated. Switching off error reporting for a whole PHP script is therefore in general not a good idea. But I am glad that it helped you out in this specific situation. :)
7:37 am on Mar 15, 2010 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 2, 2005
posts:505
votes: 0


It's a garbage collection system to remove old cache files. the missing files aren't a 'problem' per-say, but I really don't know why the script is looking for them, to be honest (which is -the- problem, if any).
They seem to show up 1 time for 1 page and never any more than that.

I didn't write the script, I'm just trying to interpret it. :)