Forum Moderators: coopster

Message Too Old, No Replies

FTP functions error

         

mthalavai

10:22 am on Dec 12, 2007 (gmt 0)

10+ Year Member



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 this client server. This server also have a dedicated ip address.

My Sample program

<?php

$ftp_server="server name";
$ftp_user="user name";
$ftp_pass="password";

echo "B4 connection";
$conn_id=ftp_connect($ftp_server);
....
....
...
?>

The above script is running upto the echo statement and not comes to the $conn_id definition line. Whats the reason? Can anyone help me?

Scally_Ally

2:19 pm on Dec 12, 2007 (gmt 0)

10+ Year Member



try adding a bit of error checking at the top of the page to let you know where the problem is

error_reporting(E_ALL);
ini_set("display_errors","on");

Ally

mthalavai

1:25 pm on Dec 13, 2007 (gmt 0)

10+ Year Member



Thanks Ally

I tried to that error code at top of page.But it still not response anything.

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

<?php

$ftp_server="ftp://server name";
//$ftp_server="server name";
$ftp_user="user name";
$ftp_pass="password";

echo "B4 connection";
$conn_id=ftp_connect($ftp_server);
....
....
...
?>

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/

coopster

4:17 pm on Dec 14, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, mthalavai.

First, you should not have "ftp://" in there. Have a closer look at the ftp_connect [php.net] function.