Net::FTP problem

L

lain

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!!
 
R

Richard Gration

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
 
L

lain

Richard Gration said:
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!!
 
L

lain

John Mason Jr said:
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??
 
L

lain

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?? :D (MUST read the module file properly, while i
havent read detail b4 :p)

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 :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

A timeout question using Net::FTP 2
Perl FTP Get Help 3
Net::FTP::Recursive hangs 3
Net::FTP and IBM TSO :-( 15
lcd via NET::FTP 2
Net::FTP hangs 1
ls in ftp fails 5
Net::FTP problem 2

Members online

No members online now.

Forum statistics

Threads
474,172
Messages
2,570,934
Members
47,474
Latest member
AntoniaDea

Latest Threads

Top