PHP zip remote code doesn't work
Hi,
I wrote a simple script to zip whole folder on ftp. I connect to this through ftp protocol, and I found it difficult to zip and unzip anything this way, so decided to use php as shell turned out to be too difficult for me. I run script bellow by bat file, it looks like that:
Connection and patch is ok because I was using this to remove files (rm) and it works then. Also when I try to run this php script in a php file through browser, then it works so system() function is available at my hosting. Bellow is log, and there is nothing so I have no idea why it doesn’t work.
I wrote a simple script to zip whole folder on ftp. I connect to this through ftp protocol, and I found it difficult to zip and unzip anything this way, so decided to use php as shell turned out to be too difficult for me. I run script bellow by bat file, it looks like that:
open ftp……. cd domains/tmp.hekko24.pl/public_html echo '<?php system("zip -r folder1.zip folder1") ?>' | php -q exit
Connection and patch is ok because I was using this to remove files (rm) and it works then. Also when I try to run this php script in a php file through browser, then it works so system() function is available at my hosting. Bellow is log, and there is nothing so I have no idea why it doesn’t work.
. 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