0

I am trying to sync folders between my remote server and amazon s3 using the system command through a php web page. The web page has option to browse the folder which need to sync between the server and s3

The s3 command is the below one

system('s3cmd sync '.$fldr_name.' '.BUCKET_NAME.' --config="'.AWS_CONF_FILE.'"',$return);

For small folders it is working . But I am syncing large file web pages connection is resetting .

I tried this on my php script

ignore_user_abort(true);

But no luck. Is there any way to make the webpage executable for a long time?

Thanks,

4

1 回答 1

0

您使用的方法并不理想。当服务器长时间保持打开状态时,与服务器的连接可能会由于多种原因而重置,其中一些是您无法控制的。

我建议你采取另一种方法来解决这个问题:

在服务器上排队所有这些同步任务,并且只使用在后台运行的服务(例如 cron 作业或其他)并行执行其中的几个。

当其中一个同步完成时,您将其成功/失败记录在数据库中。

然后,在 UI 中,您定期拉取第二个服务(通过定期执行的 AJAX 调用)检查数据库并返回您正在存储的挂起/成功/失败标志。如果请求仍处于待处理状态,您只需稍后重新检查即可。

于 2013-08-27T06:00:32.460 回答