General Community > Scripting Help
Question about php
(1/1)
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:
--- Code: ---}
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);
}
--- End code ---
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.
--- Code: ---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);
}
--- End code ---
im not shure if it can be CHMODed while it's open if not try this
--- Code: ---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);
}
--- End code ---
I hope this helps!
CokeCan:
Thanks! ;)
Navigation
[0] Message Index
Go to full version