Connecting Tech Pros Worldwide Forums | Help | Site Map

fopen() question

acorn71
Guest
 
Posts: n/a
#1: Dec 30 '05
hello, i just recently started getting permission errors when writing
to a file that's been working fine for a couple weeks now. i have made
no changes to the file or folder permission settings and i was
wondering if anyone knew of any other factors that could cause these
types of errors below. thanks in advance for a help with this problem.
aaron;

$content = "my file content";

// create a filename variable with the .iif extension for Quick Books
$filename = "qbprod.iif";

// delete old file so a new file can be created
unlink($filename);

// create a new file
$handle = fopen("/home/mysite/www/qbdata/$filename", 'a');

// write the contents to the file
fwrite($handle, $content);

// have dialog box prompt the user to open or save the file
header("Location:
http://www.mysite.com/qbdata/get_file.php?filename=$filename");

Warning: Unlink failed (No such file or directory) in
/home/www/mysite/qbdata/get_product_data.php on line 112

Warning: fopen("/home/goknobs/www/qbdata/qbprod.iif", "a") - Permission
denied in /home/www/mysite/qbdata/get_product_data.php on line 115

Warning: Supplied argument is not a valid File-Handle resource in
/home/www/mysite/qbdata/get_product_data.php on line 118

Warning: Cannot add header information - headers already sent by
(output started at /home/www/mysite/qbdata/get_product_data.php:112) in
/home/www/mysite/qbdata/get_product_data.php on line 121


Slant
Guest
 
Posts: n/a
#2: Dec 31 '05

re: fopen() question


Did you TRY to reset the folder permission, by chance? Also, is this
being hosted on your own personal system or is it leased space? If it
is not your own system, they may be working on something. Just a
thought.

acorn71
Guest
 
Posts: n/a
#3: Dec 31 '05

re: fopen() question



Slant wrote:[color=blue]
> Did you TRY to reset the folder permission, by chance? Also, is this
> being hosted on your own personal system or is it leased space? If it
> is not your own system, they may be working on something. Just a
> thought.[/color]

i found out it was something to do with apache assigning the file with
"nobody" permissions. not sure why it started do that out of the blue,
but the host fixed the problem.

aaron;

rovisoft
Guest
 
Posts: n/a
#4: Dec 31 '05

re: fopen() question


Well this may be happening because of some server updates, you should
check beside permissions also if you still own those files, meaning
you should check the user and group those files are associated with!

If you are hosted by a third party try contacting them to fix the
problem!

Hope it helps, Ovidiu

Closed Thread


Similar PHP bytes