I have a large file (200 MB up). I need to migrate it through PHP cron job. Using Phpseclib gives the following error:
Allowed memory size of 134217728 bytes has been exhausted (trying to allocate 4133 bytes) in / app / vendor / phpseclib / phpseclib / phpseclib / Net / SSH 2.php
Is there any way to do this with PHP cron job ?
Simple one-line code, where $ localFile is an existing CSV file
$sftp->put('/Import/coupons/coupons_import_test.csv', $localFile, NET_SFTP_LOCAL_FILE);
PS . This needs to be done after PHP created this file in the /tmp folder, so the script transition time should come into play.
[Change] I do not intend to increase the memory limit, since later files may have higher sizes. A solution in which I can transfer the file in parts (add mode) or use some shell script with PHP cron may be useful
The file size on the remote server is 111.4 MB, and the actual file is much larger on the local one.
[Change after fixing] The problem disappeared after switching to version 2.0.2 from version 1.0 I had to change the code for put
$sftp->put('/Import/coupons/coupons_import.csv', $localFile, $sftp::SOURCE_LOCAL_FILE);
php cron sftp phpseclib net-sftp
aeonsleo
source share