/    Sign up×
Community /Pin to ProfileBookmark

file last modified question

hello,

I am using this to display when a certain file was last modified and it displays Decenber 1969. Is there a way I can get it to display the real answer which is October 2006?

This is what I have for code:

[code=php] <?php
$last_modified = filemtime(“/var/www/vhosts/domain.com/subdomains/songlists/httpdocs/content/top40.php”);
echo “UPDATED FOR “;
echo date(“F Y”, $last_modified);
?>[/code]

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@bokehOct 27.2006 — filemtime is returning false.
Copy linkTweet thisAlerts:
@comptech520authorOct 30.2006 — Is there a way to make this work?
Copy linkTweet thisAlerts:
@bokehOct 30.2006 — First you need to confirm I am correct. Then you need to look into why this is so (does the file exist, is the path good, etcetera).
Copy linkTweet thisAlerts:
@comptech520authorOct 30.2006 — The path is correct
Copy linkTweet thisAlerts:
@bokehOct 30.2006 — Run: [code=php]var_dump($last_modified);[/code] and[code=php]var_dump(file_exists($file));[/code] and [code=php]var_dump(is_readable($file));[/code]See what results you get.
Copy linkTweet thisAlerts:
@NogDogOct 30.2006 — This might at least narrow down where the problem is:
[code=php]
$file = '/var/www/vhosts/domain.com/subdomains/songlists/httpdocs/content/top40.php';
if(file_exists($file))
{
$last_modified = filemtime($file);
if($last_modified === FALSE)
{
user_error("Unable to get modification time for file: $file", E_USER_WARNING);
}
else
{
echo "UPDATED FOR " . date("F Y", $last_modified)
}
}
else
{
user_error("File does not exist or is not readable: $file", E_USER_WARNING);
}
[/code]
×

Success!

Help @comptech520 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...