Do you have to connect and login every time you run a script with ftp function.
I tried to store the connection id in a session, but that did not work.
I tested it with this script:
session_start();
if(isset($_SESSION['conn_id'])){
echo ftp_pwd($_SESSION['conn_id']);
}else{
$conn_id = ftp_connect("host");
$login = ftp_login($conn_id, "user", "pass");
$_SESSION['conn_id'] = $conn_id;
echo ftp_pwd($conn_id);
}
When I reload the page I get this error:
Warning: ftp_pwd() expects parameter 1 to be resource, integer given in C:\server\test.php on line 5