![]() |
[function.ftp-get]: failed to open stream: Permission denied - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: [function.ftp-get]: failed to open stream: Permission denied (/showthread.php?tid=29493) |
[function.ftp-get]: failed to open stream: Permission denied - El Forum - 04-11-2010 [eluser]Jay Logan[/eluser] I'm trying to download some remote files with the FTP library extension by Phil S. but I keep getting this error. Code: A PHP Error was encountered The error obviously explains what the problem is but I don't know how to fix it. I've CHMOD the folders and files to 777 and other variations to see if that would help. It didn't. Any thoughts? [function.ftp-get]: failed to open stream: Permission denied - El Forum - 04-11-2010 [eluser]stuffradio[/eluser] You're probably using the wrong username/password or that user doesn't have access to the folder. [function.ftp-get]: failed to open stream: Permission denied - El Forum - 04-12-2010 [eluser]Jay Logan[/eluser] Well the user name / password works in FileZilla and it actually works with the FTP library because it reads the directory and loops through the files correctly. Code: $config['hostname'] = "www.hostdomain.com"; [function.ftp-get]: failed to open stream: Permission denied - El Forum - 04-12-2010 [eluser]Phil Sturgeon[/eluser] Code: function download($rempath, $locpath, $mode = 'auto') I think you are looking at the ftp_get() parameters and not the parameters for the FTP::download() method. Code: $this->ftp->download('/home/localusername/tmp/'.$file, '/tmp/awstats/'.$file, 'ASCII', 0755); Something like that should do the trick. [function.ftp-get]: failed to open stream: Permission denied - El Forum - 04-12-2010 [eluser]Jay Logan[/eluser] I tried it your way and got this error instead. Code: Message: ftp_get(/home/user/tmp/awstats.domain.com.conf) [function.ftp-get]: failed to open stream: No such file or directory Which leads me to believe the original parameters were correct. [function.ftp-get]: failed to open stream: Permission denied - El Forum - 04-12-2010 [eluser]Phil Sturgeon[/eluser] You may well be right. It threw me when I saw ", 0755". This function swaps the 1st and 2nd param to the opposite order of ftp_get(). I haven't used this in ages, but remember that full server paths aren't always the same as full FTP paths. [function.ftp-get]: failed to open stream: Permission denied - El Forum - 04-13-2010 [eluser]Jay Logan[/eluser] Solved. Had to rethink my strategy and came up with this ugly, yet functional solution. The problem was I was moving 300 accounts over to a dedicated server. Although HostGator offers a transfer server, they tend to ignore .htaccess files and I also needed to update my local DB with the new log in info and server IP addresses. Plus I wanted to transfer my AWStats. Here is what I came up with. Code: $this->load->library(array('ftp', 'whm')); |