doudeng9425 2019-03-29 13:15
浏览 48

如何使用Plesk API下载Plesk服务器备份?

According to the documentation I have to use the following code:

<packet>
    <backup-manager>
        <download-file>
            <server></server>
            <filename>backup_info_1903291320.xml</filename>
        </download-file>
    </backup-manager>
</packet>

However, when I execute the script I get the following error

Allowed memory size of 134217728 bytes exhausted (tried to allocate 65019904 bytes)

Ive tried to set the memory limit in PHP.

ini_set('memory_limit', '-1');

But that doens't work either, it runs out of memory.

Out of memory (allocated 524288000) (tried to allocate 520097792 bytes)

Did I execute the request correctly? Other requests work fine, like requesting a list of backups. Only trying to download it breaks my code. I hope a Plesk expert can help me out here.

This is the code I wrote:

class Plesk_Synch
{
    private $node1;

    private $node2;

    public function __construct()
    {
        $this->node1 = new \PleskX\Api\Client( 'IP_OF_THE_SERVER' );
        $this->node1->setCredentials( 'username', 'pass' );

        $this->node2 = new \PleskX\Api\Client( 'IP_OF_THE_SERVER' );
        $this->node2->setCredentials( 'username', 'pass' );
    }

    public function init()
    {

    }

    public function download_backup()
    {
        $request = <<<EOF
<packet>
<backup-manager>
   <download-file>
    <server></server>
    <filename>backup_info_1903291320.xml</filename>
   </download-file>
</backup-manager>
</packet>
EOF;

        return $this->node1->request($request);
    }
}

$plesk_synch = new Plesk_Synch();

// Download backup
$plesk_synch->download_backup();
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
    • ¥20 怎么用dlib库的算法识别小麦病虫害
    • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
    • ¥15 java写代码遇到问题,求帮助
    • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?