unix - Keep shell open with PHP to allow multiple calls? -
How can I open the shell session until I close it with PHP?
In my example, I want to use NCFTP to publish some files through shell command. I want PHP to be created in FTP because it is very slow and performance is an issue.
It is easy to use ncftpput
to publish a file or directory. But if I want to loop through an array of 10 files, then log the script It has to be done, publish, log out, logging in, publishing, logging out ...
It would be more convenient if such a thing could work.
shell_exec ('ncftp -u username -p password'); Foreign Currency ($ files as $ $) {shell_exec ('put'. $ File ['local_path']. ''. $ File ['remote_path']); } Shell_exec ('left');
Is this possible?
Thank you!
If you just need access to a process, then you can probably use it Or you can do this.
Something can work like this:
$ handle = popen ('Ncftp -u username -p password', 'w'); Foreign Currency ($ files as $ $) {FILIT ($ handle, 'put'. $ File ['local_path']. ''. $ $ File ['remote_path']. "\ N"); } Pclose ($ handle);
Comments
Post a Comment