0

I have a VPS with 2 CPanel accounts and I need to write a file from account1 to account2 and I have the following error:

Warning: fopen(/home/account2/public_html/files/file.csv) [function.fopen]: failed to open stream: Permission denied in /home/account1/public_html/test.php on line 7

My code:

$content = array('sku','status','visibility');
$fp_mt = fopen("/home/account2/public_html/files/file.csv", 'w');
fputcsv($fp_mt, $content);
fclose($fp_mt);

Someone have an idea what I need to do?

Thanks

Lino
  • 19,604
  • 6
  • 47
  • 65
Luis
  • 1,040
  • 1
  • 14
  • 22
  • go into the files directory and run into the terminal `sudo chmod 777 file.csv` – Mihai Dec 01 '15 at 18:50
  • The file doesn't exist when the php run, every file will have different name – Luis Dec 01 '15 at 18:52
  • Even the parent directory have permissions 777 – Luis Dec 01 '15 at 18:54
  • http://superuser.com/questions/264383/how-to-set-file-permissions-so-that-new-files-inherit-same-permissions – Mihai Dec 01 '15 at 18:55
  • If you are using suphp, you will have to add both users in the same group in httpd.conf also you will have to exclude openbasedir restriction if it is enabled... – Kailash Aghera Dec 09 '15 at 11:13
  • Possible duplicate of [PHP - Failed to open stream : No such file or directory](http://stackoverflow.com/questions/36577020/php-failed-to-open-stream-no-such-file-or-directory) – Vic Seedoubleyew Sep 11 '16 at 09:54

0 Answers0