By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,946 Members | 745 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,946 IT Pros & Developers. It's quick & easy.

FTP Functions Error

P: 3
I am using the ftp functions in my project and it is properly run in my local server. but the same script is not working in client server.

My program
Expand|Select|Wrap|Line Numbers
  1.    <?php
  2.  
  3.         $ftp_server="server name";
  4.         $ftp_user="user name";
  5.         $ftp_pass="password";
  6.         $ftp_port=21;
  7.  
  8.         echo "B4 connection";
  9.        // $conn_id=ftp_connect($ftp_server);
  10.         $conn_id=ftp_connect($ftp_server,$ftp_port);
  11.            ....
  12.             ....
  13.            ...
  14.   ?>
  15.  
In this script is running upto the echo statement only not comes to the $conn_id definition line. But this script is successfully run and connect to another server. I also try to use with port number assigning to this script. That time too not working.Anybody know about the reason?Please help me.


Thanks
M.Thalavai
Dec 7 '07 #1
Share this Question
Share on Google+
4 Replies


Markus
Expert 5K+
P: 6,050
im sorry friend, i couldn't make out your problem; you say it's connection, so what is the problem?

Maybe if you posted the full code, or a larger version, we could help a bit more.

thanks, markus.
Dec 7 '07 #2

P: 3
Thanks markus,Here i given the normal simple ftp connection program through php.
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3.  $ftp_server="host name";
  4.  $ftp_usr="user name";
  5.  $ftp_pwd="password";
  6.  $ftp_port=21;
  7.  
  8.  echo "Ftpserver :  $ftp_server <br>";
  9. // $conn_id = ftp_connect($ftp_server,$ftp_port) or die("Couldn't connect to $ftp_server"); 
  10. // $conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server"); 
  11. $conn_id = ftp_connect($ftp_server,$ftp_port) or die("Couldn't connect to $ftp_server"); 
  12.  
  13.  $login    = ftp_login($conn_id,$ftp_usr,$ftp_pwd);
  14.  
  15.  if(!$login){
  16.    echo "FTP Server connection has failed"; 
  17.    exit;    }
  18.  else {
  19.    echo "Successful connection"; exit;}
  20.  
  21.  ?>
  22.  
This is my simple script.It is successfully run in my server not run in client server. I dont know about the reason.

Thanks
M.Thalavai






im sorry friend, i couldn't make out your problem; you say it's connection, so what is the problem?

Maybe if you posted the full code, or a larger version, we could help a bit more.

thanks, markus.
Dec 8 '07 #3

P: 3
Now i am trying ftp functions with assigns the format of server name in $ftp_server as follows

$ftp_Server="ftp:// server name /";

My Sample program
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. $ftp_server="ftp://server name";
  4. //$ftp_server="server name";
  5. $ftp_user="user name";
  6. $ftp_pass="password";
  7.  
  8. echo "B4 connection";
  9. $conn_id=ftp_connect($ftp_server);  ///line no: 9
  10. ....
  11. ....
  12. ...
  13. ?>
  14.  
This simple script runs and causes the following error.


Warning: ftp_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/content/html/ftp_conn.php on line 9

Couldn't connect to ftp://server name/

Anybody known about the reason?

Thanks
M.Thalavai
Dec 13 '07 #4

pbmods
Expert 5K+
P: 5,821
Heya, M.Thalavai.

Please use CODE tags when posting source code:

[CODE=php]
PHP code goes here.
[/CODE]
Dec 23 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.