Re: using fopen() in write mode is failing
- From: lawrence k <lkrubner@xxxxxxxxxxxxx>
- Date: Fri, 30 May 2008 19:59:47 -0700 (PDT)
On May 30, 4:08 pm, cscor...@xxxxxxxxx wrote:
For some reason, I cannot use fopen() on the file in write mode. The
file "time" is in the same directory as the .php file, with
permissions set to 0766.
PHP Version 5.2.5
Apache/2.2.8
code snip in question:
$file = "time";
function updateParseTime($name){
global $file;
if (file_exists($name) && file_exists($file)) {
if(($fp = fopen($file,"wb"))){
$lastmod = filemtime($name);
if(!(fwrite($fp, $lastmod))){
echo "cannot update time";
}
}
else{
echo "$file cannot be opened. \n";
}
}
else{
echo "$name or $file not found.";
}
}
on the 4th line it fails the if check ($fp = fopen...) and just
outputs "$file cannot be opened"
Am I missing something?
A little off-topic, but your code is an example of the Arrow Anti-
Pattern:
http://c2.com/cgi/wiki?ArrowAntiPattern
http://www.codinghorror.com/blog/archives/000486.html
.
- Follow-Ups:
- Re: using fopen() in write mode is failing
- From: Gordon
- Re: using fopen() in write mode is failing
- References:
- using fopen() in write mode is failing
- From: cscorley
- using fopen() in write mode is failing
- Prev by Date: Re: Sudden increase in php-jobs
- Next by Date: Re: using fopen() in write mode is failing
- Previous by thread: Re: using fopen() in write mode is failing
- Next by thread: Re: using fopen() in write mode is failing
- Index(es):
Relevant Pages
|