|
Posted by Patrick Schlangen on 08/19/06 23:01
Hi,
> - How could I know if the FTP functions are enabled at PHP
> installation?
they are. Otherwise you would get a error about a undefined function.
> - How to make the FTP functions work?
You might need to use PASSIVE ftp mode (e.g. because of firewall or NAT
settings).
Just try this:
#! /usr/bin/php
<?php
$ftp_server = "myftpserver";
$connect = ftp_connect($ftp_server)
or die("Couldn't connect to $ftp_server.");
$result = ftp_login($connect, "myftpuser", "mypassword")
or die("Couldn't log in $ftp_server.");
ftp_pasv($connect, true);
$a = ftp_nlist($connect, "/");
foreach($a as $value){
echo $value, "\n";
}
?>
I just added one line (""ftp_pasv($connect, true);"").
Please let us know if it works now.
Patrick
Navigation:
[Reply to this message]
|