[function.ftp-get]: failed to open stream: Permission denied |
[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?
[eluser]stuffradio[/eluser]
You're probably using the wrong username/password or that user doesn't have access to the folder.
[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";
[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.
[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.
[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.
[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')); |
Welcome Guest, Not a member yet? Register Sign In |