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($n ame) && file_exists($fi le)) {
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?
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($n ame) && file_exists($fi le)) {
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?
Comment