WinScp-PHP zip 远程代码不起作用

WinScp-PHP zip 远程代码不起作用

我写了一个简单的脚本来压缩 ftp 上的整个文件夹。我通过 ftp 协议连接到它,我发现用这种方式压缩和解压任何东西都很困难,所以决定使用 php 作为 shell,结果对我来说太难了。我通过 bat 文件运行下面的脚本,它看起来像这样:

open ftp…….
cd domains/tmp.hekko24.pl/public_html
echo '<?php system("zip -r folder1.zip folder1") ?>' | php -q
exit

连接和补丁都正常,因为我用它来删除文件 (rm),然后它就正常工作了。此外,当我尝试通过浏览器在 php 文件中运行此 php 脚本时,它也能正常工作,因此我的主机上可以使用 system() 函数。下面是日志,但没有任何内容,所以我不知道它为什么不起作用。

. 2019-04-28 19:37:12.074 Using FTP protocol.
. 2019-04-28 19:37:12.074 Doing startup conversation with host.
> 2019-04-28 19:37:12.074 PWD
< 2019-04-28 19:37:12.095 257 "/" is the current directory
. 2019-04-28 19:37:12.095 Getting current directory name.
. 2019-04-28 19:37:12.095 Startup conversation with host finished.
< 2019-04-28 19:37:12.095 Script: Aktywna sesja: [1] xxxxxxx@xxxxxxxxxx
> 2019-04-28 19:37:12.099 Script: cd domains/tmp.hekko24.pl/public_html
. 2019-04-28 19:37:12.099 Cached directory change via "domains/tmp.hekko24.pl/public_html" to "/domains/tmp.hekko24.pl/public_html".
. 2019-04-28 19:37:12.099 Getting current directory name.
< 2019-04-28 19:37:12.099 Script: /domains/tmp.hekko24.pl/public_html
> 2019-04-28 19:37:12.103 Script: echo '<?php system("zip -r folder1.zip folder1") ?>' | php -q
< 2019-04-28 19:37:12.103 Script: '<?php system("zip -r folder1.zip folder1") ?>' | php -q
> 2019-04-28 19:37:12.106 Script: exit
. 2019-04-28 19:37:12.106 Script: Exit code: 0
. 2019-04-28 19:37:12.109 Rozłączono z serwerem

相关内容