lupus2203 Posted March 26, 2013 Share Posted March 26, 2013 How to unzip files on remote server using PHP script.I tried to like this: $zip = new ZipArchive;$res = $zip->open('http://madm.dfki.de/demo/ip-countryside/ip2country.zip');if ($res === TRUE) { $zip->extractTo($_SERVER['DOCUMENT_ROOT'].'/app/webroot/ip2country/'); $zip->close(); echo 'ok';} else { echo 'failed, code:' . $res;}but, it does not work. This error occurs:Unable to access http://madm.dfki.de/demo/ip-countryside/ip2country.zipHow to solve this problem? Link to comment https://forums.phpfreaks.com/topic/276177-how-to-unzip-files-on-remote-server-using-php-script/ Share on other sites More sharing options...
fesan Posted March 26, 2013 Share Posted March 26, 2013 Try setting the file permission to 744 in your script. http://php.net/manual/en/function.chmod.php change it back to 644 or whatever your correct mode is after executing the zip. Link to comment https://forums.phpfreaks.com/topic/276177-how-to-unzip-files-on-remote-server-using-php-script/#findComment-1421181 Share on other sites More sharing options...
exeTrix Posted March 26, 2013 Share Posted March 26, 2013 I don't think it's relating to permissions because I can download the file, so we can assume the issue isn't permission related. As far as I can tell the open method requires a file that's relative to the filesystem. Basically, I don't think it allows you to open files via HTTP, FTP or HTTPS protocols because the class doesn't extend SPLFileObject. I'd suggest trying to store the zip on the server using fopen (http://php.net/manual/en/function.fopen.php) then opening the ZipArchive and clear the tmp file in __destruct method. Link to comment https://forums.phpfreaks.com/topic/276177-how-to-unzip-files-on-remote-server-using-php-script/#findComment-1421191 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.