Would it work if I save the ftp_connect resource id, and load it and use it?
Because we know FTP connections halts at script end. Im thinking of creating a background process which does the ftp_connect(), and the main script would work with that resource ID, would it be possible?
Would it work if I save the ftp_connect resource id, and load it and
Share
No. The resource handles are just like file handles – specific to the process that created them. The background process can certainly pass the resourcearound, but it’d be meaningless to other processes.
You can have inter-process communications so your foreground request can tell the background (which is holding the ftp connection open) to do something. But that opens up a whole other can of worms if this’ll be happening multiple times in parallel.