The FTP extension has ftp_get_option() function which returns the timeout variable. This function needs to be created and contain it as static variable.
The FTP extension has ftp_set_option() function which sets the timeout variable. This function needs to be created and called here.