Re: using fopen() in write mode is failing
- From: "Rik Wasmus" <luiheidsgoeroe@xxxxxxxxxxx>
- Date: Sat, 31 May 2008 16:07:55 +0200
On Sat, 31 May 2008 15:55:26 +0200, Jerry Stuckle <jstucklex@xxxxxxxxxxxxx> wrote:
Rik Wasmus wrote:On Sat, 31 May 2008 15:33:25 +0200, Jerry Stuckle <jstucklex@xxxxxxxxxxxxx> wrote:
Rik Wasmus wrote:Erm:On Sat, 31 May 2008 14:52:04 +0200, Jerry Stuckle <jstucklex@xxxxxxxxxxxxx> wrote:
cscorley@xxxxxxxxx wrote:He just said Fedora9(PHP5.2.5 for distro).On May 30, 3:08 pm, cscor...@xxxxxxxxx wrote:For some reason, I cannot use fopen() on the file in write mode. TheActually, I think it must have something to do with the way this
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?
particular webserver is setup (be it apache/php), because it works
fine when tested on another server (not maintained by me).
What OS is it running on (i.e. if Linux, which distro)? It could be the OS security isn't allowing it, despite the file flags.
I'd be interested in a clearstatcache();printf('%o',fileperms('time')); output.
Ah, I missed that, Rik - this thread is getting too long for my short memory! :-)
I've never used Fedora9 - but I don't *think* it has additional security features (like SE Linux), does it?
"Fedora is the first mainstream operating system to provide MAC (Mandatory Access Control) based security using ["SELinux"] enabled by default. "
So, now that you mention it, a chcon might be necessary...
Ah, OK. As I said I'm not familiar with it.
Haven't worked with SELinux either.. But it just might be the cause of all this trouble.
--
Rik Wasmus
....spamrun finished
.
- References:
- using fopen() in write mode is failing
- From: cscorley
- Re: using fopen() in write mode is failing
- From: cscorley
- Re: using fopen() in write mode is failing
- From: Jerry Stuckle
- Re: using fopen() in write mode is failing
- From: Rik Wasmus
- Re: using fopen() in write mode is failing
- From: Jerry Stuckle
- Re: using fopen() in write mode is failing
- From: Rik Wasmus
- Re: using fopen() in write mode is failing
- From: Jerry Stuckle
- using fopen() in write mode is failing
- Prev by Date: Re: How to test that an array is 'indexed' vs 'associative'
- Next by Date: Re: How to test that an array is 'indexed' vs 'associative'
- Previous by thread: Re: using fopen() in write mode is failing
- Next by thread: how to invoke ReflectionMethod and pass variable by reference as argument?
- Index(es):
Relevant Pages
|