Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Net::FTP problem

Reply
Thread Tools

Net::FTP problem

 
 
lain
Guest
Posts: n/a
 
      07-08-2005
Hi all,

I have big trouble on Net::FTP, could you please give me some idea??

My ftp server is on Win2K Prof, IIS.

First, I tried ftp on my linux server , it works fine.

Then I created a cgi script, run the script manually on linux server,
to get the file from that Win2K and put on my linux server, it works
fine too.

However, while i was on my php web system, submit the php POST to the
cgi-script, it show me the internal error.
I go to error log, it shows me the error:
cant open the file, permission denied.

I really do not know what's wrong, is it my ftp problem? coding
problem or network prob??

1. i have set the full permission on ftp folder in win2k.
2. chmod 777 on my cgi-script
3. the ftp folder located in C://inetpub/ftproot/test (created as
virtual directory)

any suggestions, comments, helps are all welcomed.
I'm going to try an alternative to do the task.

Thanks a lot!!
 
Reply With Quote
 
 
 
 
Richard Gration
Guest
Posts: n/a
 
      07-08-2005
On Fri, 08 Jul 2005 00:31:30 -0700, lain wrote:

> Hi all,
>
> I have big trouble on Net::FTP, could you please give me some idea??
>
> My ftp server is on Win2K Prof, IIS.
>
> First, I tried ftp on my linux server , it works fine.
>
> Then I created a cgi script, run the script manually on linux server,
> to get the file from that Win2K and put on my linux server, it works
> fine too.
>
> However, while i was on my php web system, submit the php POST to the
> cgi-script, it show me the internal error.
> I go to error log, it shows me the error:
> cant open the file, permission denied.


I'm not sure I followed your explanation properly, but I figure that you
are trying to pull a file from a Win2K FTP server to a Linux box by
submitting to a cgi script (which uses NET::FTP to get the file) on the
Linux box from a web-browser? If so, then you need to understand that cgi
scripts run as a specific user, usually apache or httpd and that 99 times
out of a 100 this user doesn't have write permission to the file's
destination, as per the error message you are seeing. You must fix this by
either 1) having the script write the file somewhere it already has
permission or 2) change the permissions where it is trying to write so
that it can.

HTH
Rich
 
Reply With Quote
 
 
 
 
lain
Guest
Posts: n/a
 
      07-10-2005
Richard Gration <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>.. .
> On Fri, 08 Jul 2005 00:31:30 -0700, lain wrote:
>
> > Hi all,
> >
> > I have big trouble on Net::FTP, could you please give me some idea??
> >
> > My ftp server is on Win2K Prof, IIS.
> >
> > First, I tried ftp on my linux server , it works fine.
> >
> > Then I created a cgi script, run the script manually on linux server,
> > to get the file from that Win2K and put on my linux server, it works
> > fine too.
> >
> > However, while i was on my php web system, submit the php POST to the
> > cgi-script, it show me the internal error.
> > I go to error log, it shows me the error:
> > cant open the file, permission denied.

>
> I'm not sure I followed your explanation properly, but I figure that you
> are trying to pull a file from a Win2K FTP server to a Linux box by
> submitting to a cgi script (which uses NET::FTP to get the file) on the
> Linux box from a web-browser? If so, then you need to understand that cgi
> scripts run as a specific user, usually apache or httpd and that 99 times
> out of a 100 this user doesn't have write permission to the file's
> destination, as per the error message you are seeing. You must fix this by
> either 1) having the script write the file somewhere it already has
> permission or 2) change the permissions where it is trying to write so
> that it can.
>
> HTH
> Rich



Hi Rich,

Could you please explain in detail??
See, I've chmod 777 to the cgi script. Would that still not enough??
I've considered maybe it cant write anything on cgi-bin directory, coz
from the Net::FTP module, I've learnt that the retrieved file would
'temporary' located at the current working directory.
But While i run the script manually it works, never show the error
message and i can put the file to another directory after.
Or while i GET the file i should force it to store on another
directory??
I'd done like this:
$ftp->GET("the file i want to retrieve", "the location i want to put
temporary of the file");
ie : $ftp->GET("image.jpg", "http://231.12.255.1/folder/image.jpg");
But it showed me the error : couldnt find the file.

Hear from you Rich!!
 
Reply With Quote
 
lain
Guest
Posts: n/a
 
      07-10-2005
John Mason Jr <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> lain wrote:
> > Hi all,
> >
> > I have big trouble on Net::FTP, could you please give me some idea??
> >
> > My ftp server is on Win2K Prof, IIS.
> >
> > First, I tried ftp on my linux server , it works fine.
> >
> > Then I created a cgi script, run the script manually on linux server,
> > to get the file from that Win2K and put on my linux server, it works
> > fine too.
> >
> > However, while i was on my php web system, submit the php POST to the
> > cgi-script, it show me the internal error.
> > I go to error log, it shows me the error:
> > cant open the file, permission denied.
> >
> > I really do not know what's wrong, is it my ftp problem? coding
> > problem or network prob??
> >
> > 1. i have set the full permission on ftp folder in win2k.
> > 2. chmod 777 on my cgi-script
> > 3. the ftp folder located in C://inetpub/ftproot/test (created as
> > virtual directory)
> >
> > any suggestions, comments, helps are all welcomed.
> > I'm going to try an alternative to do the task.
> >
> > Thanks a lot!!

>
>
> Make sure your directory listing style is Unix not MS-DOS on the IIS FTP
> server
>
>
> John



Hi John,

That's correct, the directory listing was MS-DOS on my FTP server.
Then I changed to Unix, but it doesnt work...still the same error
message : permission denied T_T
Do you have ny other idea??
 
Reply With Quote
 
lain
Guest
Posts: n/a
 
      07-13-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) (lain) wrote in message news:<(E-Mail Removed). com>...
> John Mason Jr <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> > lain wrote:
> > > Hi all,
> > >
> > > I have big trouble on Net::FTP, could you please give me some idea??
> > >
> > > My ftp server is on Win2K Prof, IIS.
> > >
> > > First, I tried ftp on my linux server , it works fine.
> > >
> > > Then I created a cgi script, run the script manually on linux server,
> > > to get the file from that Win2K and put on my linux server, it works
> > > fine too.
> > >
> > > However, while i was on my php web system, submit the php POST to the
> > > cgi-script, it show me the internal error.
> > > I go to error log, it shows me the error:
> > > cant open the file, permission denied.
> > >
> > > I really do not know what's wrong, is it my ftp problem? coding
> > > problem or network prob??
> > >
> > > 1. i have set the full permission on ftp folder in win2k.
> > > 2. chmod 777 on my cgi-script
> > > 3. the ftp folder located in C://inetpub/ftproot/test (created as
> > > virtual directory)
> > >
> > > any suggestions, comments, helps are all welcomed.
> > > I'm going to try an alternative to do the task.
> > >
> > > Thanks a lot!!

> >
> >
> > Make sure your directory listing style is Unix not MS-DOS on the IIS FTP
> > server
> >
> >
> > John

>
>
> Hi John,
>
> That's correct, the directory listing was MS-DOS on my FTP server.
> Then I changed to Unix, but it doesnt work...still the same error
> message : permission denied T_T
> Do you have ny other idea??


Hi all,

I'd solved the problem already!!
I would like to answer here in case somebody else need the reference
in future, as me, I searched many similar topic but without the proper
answer!!
Maybe there got something else can solve it out, but this is my
solution :

First, the reason I got the 'permission denied' while i run my cgi
script on the browser is because I act as end user, not the root as
well.

Read from the Net/FTP.pm, when you get the file, it would store the
file in the current directory,in case if you haven't specified the
location. Therefore it would store in the cgi-bin folder, and do you
think it is possible?? (MUST read the module file properly, while i
havent read detail b4 )

So I'd made this :

1. create a folder in public_html, lets say 'temp' (havent tried out
if can store the file besides public_html, but i think possibly can)
2. chmod 777 temp ( i m not that sure if 755 is enough)

my code:
$ftp->get("file1.txt", "/home/server/public_html/temp/file1.txt");

before i was trying to locate it as "../public_html/temp", but it is
really bad idea!

simple right??

Anyway, i do believe there got better solution out there. If you do
have any comments and anything else, please share with me
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem problem problem :( Need Help Mike ASP General 2 05-11-2004 08:36 AM



Advertisments