News:

Join the Facebook Fan Page.

Main Menu

Question about php

Started by CokeCan, August 03, 2003, 05:49:03 PM

Previous topic - Next topic

CokeCan

I am running a php script, it should generate a *.txt file and CHMOD it 666 but it's CHMOD it to 644, can someone please let me know what should I change?

The part of the scrip that generates it is:

}
if ($regenerar == 1) {
     $file = new GetWebObject($url2, 80, $x);
     $fd = fopen("/home/vhost/home/www/txt/$subcodigo$cat$palabras.txt","w");
     fwrite($fd,$file->get_content());
     fclose($fd);
}


Thanks in advanced! :)

Aquilo

I don't know what GetWebObject() class is doing but this should do what your asking, the only thig is if that class is CHMODing then you'll be doing it twice.


if ($regenerar == 1) {
    $file = new GetWebObject($url2, 80, $x);
    $fd = fopen("/home/vhost/home/www/txt/$subcodigo$cat$palabras.txt","w");
    fwrite($fd,$file->get_content());
    chmod ($fd, 0666);
    fclose($fd);
}


im not shure if it can be CHMODed while it's open if not try this

if ($regenerar == 1) {
    $file = new GetWebObject($url2, 80, $x);
    $fd = fopen("/home/vhost/home/www/txt/$subcodigo$cat$palabras.txt","w");
    fwrite($fd,$file->get_content());
    fclose($fd);
    chmod ("/home/vhost/home/www/txt/$subcodigo$cat$palabras.txt", 0666);
}


I hope this helps!

CokeCan


Advertisement: