473,382 Members | 1,367 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

fileatime() error

Ben
Hi all,
I have a following function in an external file:

<?php
function counter($hostaddr,$fname) {
$currentfile="/".$hostaddr.$fname;
echo $currentfile;
if (file_exists($currentfile)) {
$fileatime = date("F d Y H:i:s.", fileatime($currentfile));
echo "testing...".$fileatime;
}
.............
.............
?>

this function is called by another php file... my problem is on the
"if statement". The fileatime($currentfile) function doesn't seem to
work well.. If I leave this file as it is above, it doesn't show error
but later on the code, there is problem because of this... If I
comment out the "if" line and the "closing brace", then it gives me
the following error:

Warning: fileatime() [function.fileatime]: stat failed for
/localhost/index.php in D:\Apache Group\Apache2\htdocs\phpfunc.php on
line 7
testing...January 01 1970 11:00:00.

what's am i doing wrong? i just couldn't figure it out!

Hope someone can help me!
Thanx
Ben
Jul 17 '05 #1
8 2388
"Ben" <cr*********@yahoo.com> wrote in message
news:d9**************************@posting.google.c om...
Hi all,
I have a following function in an external file:

<?php
function counter($hostaddr,$fname) {
$currentfile="/".$hostaddr.$fname;
echo $currentfile;
if (file_exists($currentfile)) {
$fileatime = date("F d Y H:i:s.", fileatime($currentfile));
echo "testing...".$fileatime;
}
............
............
?>

this function is called by another php file... my problem is on the
"if statement".
You are only assuming it is on the "if" statement.
The fileatime($currentfile) function doesn't seem to
work well..
Please define "doesn't seem to work well". What is happening? A message?
What values do you have in your fields? What verion of PHP? Do you have the
necessary wrappers installed to open files via URLs (assuming the contents
of these fields will result in a URL)?
If I leave this file as it is above, it doesn't show error
What error?
but later on the code, there is problem because of this... If I
comment out the "if" line and the "closing brace", then it gives me
the following error:

Warning: fileatime() [function.fileatime]: stat failed for
/localhost/index.php in D:\Apache Group\Apache2\htdocs\phpfunc.php on
line 7
testing...January 01 1970 11:00:00.

what's am i doing wrong? i just couldn't figure it out!


Mostly asking questions in an inappropriate fashion. Restate your question
in an more informative manner and we can probably help (and will gladly do
so).

- Virgil
Jul 17 '05 #2
Ben <cr*********@yahoo.com> wrote:
Warning: fileatime() [function.fileatime]: stat failed for
/localhost/index.php in D:\Apache Group\Apache2\htdocs\phpfunc.php on
line 7
testing...January 01 1970 11:00:00.

what's am i doing wrong? i just couldn't figure it out!


What filesystem are you using? Does it support atime? Probably not by
according to the error.

--

Daniel Tryba

Jul 17 '05 #3
Ben wrote:
Warning: fileatime() [function.fileatime]: stat failed for
/localhost/index.php in D:\Apache Group\Apache2\htdocs\phpfunc.php on
line 7
testing...January 01 1970 11:00:00.

what's am i doing wrong? i just couldn't figure it out!


just have a look on the file you are calling the function for
"/localhost/index.php" - this means "D:/localhost/index.php". I'm quite
sure this file doesn't exist.

greetings, Christian
Jul 17 '05 #4
Ben
"Virgil Green" <vj*@DESPAMobsydian.com> wrote in message news:<PO***************@newssvr23.news.prodigy.com >...
"Ben" <cr*********@yahoo.com> wrote in message
news:d9**************************@posting.google.c om...
Hi all,
I have a following function in an external file:

<?php
function counter($hostaddr,$fname) {
$currentfile="/".$hostaddr.$fname;
echo $currentfile;
if (file_exists($currentfile)) {
$fileatime = date("F d Y H:i:s.", fileatime($currentfile));
echo "testing...".$fileatime;
}
............
............
?>

this function is called by another php file... my problem is on the
"if statement".
You are only assuming it is on the "if" statement.


ok i'll try to clarify my problem.. sorry I didn't address my problem
clearly...
I'm not sure whether my problem is on the "if statement" or on
"fileatime()". Please read on...
The fileatime($currentfile) function doesn't seem to
work well..
Please define "doesn't seem to work well". What is happening? A message?
What values do you have in your fields? What verion of PHP? Do you have the
necessary wrappers installed to open files via URLs (assuming the contents
of these fields will result in a URL)?

If I comment out the "if statement", I get the warning message that I
mentioned before, which is:
Warning: fileatime() [function.fileatime]: stat failed for
/localhost/index.php in D:\Apache Group\Apache2\htdocs\phpfunc.php on
line 7 testing...January 01 1970 11:00:00.

The line 7 is:
$fileatime = date("F d Y H:i:s.", fileatime($currentfile));

The "$currentfile" variable contains the value: /localhost/index.php

My "counter()" function is on "phpfunc.php" file which is simply
called by another file. I am using PHP version 5.0.1. I'm not sure
about the wrappers. Can you tell me which wrappers are to be
installed. Maybe I can find out using phpinfo().
If I leave this file as it is above, it doesn't show error


What error?


Not error.. I mean the above warning... sorry!!sorry!!
but later on the code, there is problem because of this... If I
comment out the "if" line and the "closing brace", then it gives me
the following error:

Warning: fileatime() [function.fileatime]: stat failed for
/localhost/index.php in D:\Apache Group\Apache2\htdocs\phpfunc.php on
line 7
testing...January 01 1970 11:00:00.

what's am i doing wrong? i just couldn't figure it out!
Mostly asking questions in an inappropriate fashion. Restate your question
in an more informative manner and we can probably help (and will gladly do
so).


I know I haven't been very clear... Hope I've restated my problem more
clearly this time.
- Virgil

Jul 17 '05 #5
"Ben" <cr*********@yahoo.com> wrote in message
news:d9**************************@posting.google.c om...
"Virgil Green" <vj*@DESPAMobsydian.com> wrote in message

news:<PO***************@newssvr23.news.prodigy.com >...
"Ben" <cr*********@yahoo.com> wrote in message
news:d9**************************@posting.google.c om...
Hi all,
I have a following function in an external file:

<?php
function counter($hostaddr,$fname) {
$currentfile="/".$hostaddr.$fname;
echo $currentfile;
if (file_exists($currentfile)) {
$fileatime = date("F d Y H:i:s.", fileatime($currentfile));
echo "testing...".$fileatime;
}
............
............
?>

this function is called by another php file... my problem is on the
"if statement".


You are only assuming it is on the "if" statement.


ok i'll try to clarify my problem.. sorry I didn't address my problem
clearly...
I'm not sure whether my problem is on the "if statement" or on
"fileatime()". Please read on...
The fileatime($currentfile) function doesn't seem to
work well..


Please define "doesn't seem to work well". What is happening? A message?
What values do you have in your fields? What verion of PHP? Do you have the necessary wrappers installed to open files via URLs (assuming the contents of these fields will result in a URL)?

If I comment out the "if statement", I get the warning message that I
mentioned before, which is:
Warning: fileatime() [function.fileatime]: stat failed for
/localhost/index.php in D:\Apache Group\Apache2\htdocs\phpfunc.php on
line 7 testing...January 01 1970 11:00:00.


This message indicates that you are trying to get a file from the filesystem
looking in a directory called localhost which is expected to be in the root
directory of the current drive (as indicated by another responder). Did you
mean that file reference to be an HTTP URL? Did you mean it to be a
reference into the file system?

- Virgil
Jul 17 '05 #6
Ben
"Virgil Green" <vj*@DESPAMobsydian.com> wrote in message news:<Ev*******************@newssvr22.news.prodigy .com>...

<snip>

If I comment out the "if statement", I get the warning message that I
mentioned before, which is:
Warning: fileatime() [function.fileatime]: stat failed for
/localhost/index.php in D:\Apache Group\Apache2\htdocs\phpfunc.php on
line 7 testing...January 01 1970 11:00:00.


This message indicates that you are trying to get a file from the filesystem
looking in a directory called localhost which is expected to be in the root
directory of the current drive (as indicated by another responder). Did you
mean that file reference to be an HTTP URL? Did you mean it to be a
reference into the file system?


i read from msg sent by another responder indicating the same thing...
well actually I've kept all my "index.php" file in D:\Apache
Group\Apache2\htdocs\, which is my local web server's document
directory. I've also tried passing "http://localhost/index.php" in
fileatime() and got same warning.. i think fileatime() doesn't accept
URLs. I'm using PHP 5.0.1. So how do I use URLs in fileatime()? or do
i have to use another function for this purpose?

Thnax
Ben
Jul 17 '05 #7
>i read from msg sent by another responder indicating the same thing...
well actually I've kept all my "index.php" file in D:\Apache
Group\Apache2\htdocs\, which is my local web server's document
directory. I've also tried passing "http://localhost/index.php" in
fileatime() and got same warning..
i think fileatime() doesn't accept
URLs.
Please explain how you are going to get a file ACCESS time using
the http protocol. I don't think it's possible, and even the concept
of an access time for dynamic content is more than a bit fuzzy. At
least for a modification time, it's fairly easy to decide that the
modification time for dynamic content is "now".

I'm not so sure there's a standard way to get it for the ftp protocol,
either, even if the server does keep it in its filesystem.
I'm using PHP 5.0.1. So how do I use URLs in fileatime()?
You don't.
or do
i have to use another function for this purpose?


I think your purpose is a hopeless cause. How do I get the serial
number from a (USA) quarter? (Hint: there isn't one).

Gordon L. Burditt
Jul 17 '05 #8
"Ben" <cr*********@yahoo.com> wrote in message
news:d9**************************@posting.google.c om...
"Virgil Green" <vj*@DESPAMobsydian.com> wrote in message news:<Ev*******************@newssvr22.news.prodigy .com>...
<snip>
>
If I comment out the "if statement", I get the warning message that I
mentioned before, which is:
Warning: fileatime() [function.fileatime]: stat failed for
/localhost/index.php in D:\Apache Group\Apache2\htdocs\phpfunc.php on
line 7 testing...January 01 1970 11:00:00.


This message indicates that you are trying to get a file from the filesystem looking in a directory called localhost which is expected to be in the root directory of the current drive (as indicated by another responder). Did you mean that file reference to be an HTTP URL? Did you mean it to be a
reference into the file system?


i read from msg sent by another responder indicating the same thing...
well actually I've kept all my "index.php" file in D:\Apache
Group\Apache2\htdocs\, which is my local web server's document
directory. I've also tried passing "http://localhost/index.php" in
fileatime() and got same warning.. i think fileatime() doesn't accept
URLs. I'm using PHP 5.0.1. So how do I use URLs in fileatime()? or do
i have to use another function for this purpose?


http://us4.php.net/manual/en/wrappers.http.php
indicates that stat() is not supported by the http wrapper.

- Virgil

Jul 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: deko | last post by:
When I write to a file, the fileatime does not update - how can I get the mod date to update when writing to the file? //increment counter value by 1 $counter=file($ctr); $oldct=each($counter);...
2
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two...
5
by: Tony Wright | last post by:
Hi, I am having a problem installing an msi for a web site. The error message I am getting is: "The specified path 'http://mipdev05/features/Fas2' is unavailable. The Internet Information...
1
by: Aravind | last post by:
we have two files: 1. rc4.c (defines one function "create_pin()") 2. MyImpl.c(calling the function "create_pin()"),This implements JNI method. 1.When I am trying to create .dll file with one...
1
by: yanwan | last post by:
I met this problem in executing a c++ project in visual studio. Does anyone have suggestions to resolve "error lnk 2001"? --------------------Configuration: reconstruction - Win32...
13
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
7
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.