php - Solving fopen() - permission denied on remote server without 777 -
i find hard believe question doesn't have answer here, i've searched , searched, , can't find one.
i'm using fopen()
on remote server, , have ftp access - nothing else.
when try create or open file write access, i'm hit following error:
warning: fopen(entries/newsletter.csv): failed open stream: permission denied in /var/www/sites/xxx/public_html/index.php on line 24 error: can't open file. entry not saved.
i've tried changing file permissions 777 , opening existing file, , it works! cannot recommended solution, 777 insecure.
is there way can resolve on ftp without resorting 777?
can not change parameters on open try open in read mode? php manual fopen() options.
fopen("csv/newsletter.csv", "r");
this uses least permissions, need have read access. of course, cannot write file. also, 777 includes executable bit, might want 666.
you try connecting via ftp user, , ensure users permission file rw (6) , others, not need setting read only.
optionally through ftp interface, maybe chmod() file read/write before opening, chmod read after.
Comments
Post a Comment