I have tried so many things but ftp_connect
and ftp_ssl_connect
are not working in my development instance.
I am using MAC and PHP8.1, I am trying to connect to localhost with the below simple script:
<?php
// Connect to FTP server
$ftp_server = "localhost";
// Establish ftp connection
$ftp_connection = ftp_connect($ftp_server, 22, 10)
or die("Could not connect to $ftp_server");
if($ftp_connection) {
echo "Successfully connected to the ftp server!";
// Closing connection
ftp_close($ftp_connection);
}
?>
This is always returning bool(false)
instead of the FTP/Connection
object. I have also checked the Firewall, it is disabled on my local machine.
Do we need to configure anything in order to work with it?
Thanks
ftp localhost
(you may need to use the webserver user since the PHP script is running as that user)... You may need to useftp_login
ftp localhost
, it is working and also I am able to connect through FTP client FileZilla. Please help me I am still unable to connect viaftp_connect
.