eliteskills Posted June 13, 2006 Share Posted June 13, 2006 I'd like to unzip a file automatically in php. If I run unzip.php which contains[code]<? system('unzip -o xml.zip')[/code]It works in ssh, but it does nothing if I just go directly to the file unzip.php on my server through http request on firefox.How do I set the permissions so that it allows me to unzip the file just by going to the php page? Link to comment https://forums.phpfreaks.com/topic/11827-unzip-file-with-php/ Share on other sites More sharing options...
poirot Posted June 13, 2006 Share Posted June 13, 2006 These are probably restricted by your webserver.You should really contact the web hosting company.If your server has cPanel installed, you can use its built-in Zip extractor. Link to comment https://forums.phpfreaks.com/topic/11827-unzip-file-with-php/#findComment-44826 Share on other sites More sharing options...
eliteskills Posted June 13, 2006 Author Share Posted June 13, 2006 [!--quoteo(post=383068:date=Jun 12 2006, 09:05 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 12 2006, 09:05 PM) [snapback]383068[/snapback][/div][div class=\'quotemain\'][!--quotec--]These are probably restricted by your webserver.You should really contact the web hosting company.If your server has cPanel installed, you can use its built-in Zip extractor.[/quote]I have a dedicated server with no cpanel. I can unzip things, just not automatically in a shell script Link to comment https://forums.phpfreaks.com/topic/11827-unzip-file-with-php/#findComment-44828 Share on other sites More sharing options...
zq29 Posted June 13, 2006 Share Posted June 13, 2006 Maybe you could try dumping the output into a variable to see if any errors were returned?[code]system("unzip -o xml.zip",$output)echo $output;[/code] Link to comment https://forums.phpfreaks.com/topic/11827-unzip-file-with-php/#findComment-44984 Share on other sites More sharing options...
<?=$humour?> Posted June 13, 2006 Share Posted June 13, 2006 [!--quoteo(post=383229:date=Jun 13 2006, 10:30 PM:name=SemiApocalyptic)--][div class=\'quotetop\']QUOTE(SemiApocalyptic @ Jun 13 2006, 10:30 PM) [snapback]383229[/snapback][/div][div class=\'quotemain\'][!--quotec--]Maybe you could try dumping the output into a variable to see if any errors were returned?[code]system("unzip -o xml.zip",$output)echo $output;[/code][/quote]You'd need to use -p to pipe to stdout, if you use exec instead $output will be an array, you can implode it with "\n" to make it a string again, but if it's php source it wont render to the browser screen, something php does for safety. This way you will have closer control of the archive by bringing it into your process. If you don't want to do this then make sure that the archive is being addressed correctly and then know where the unzipped file is being written to, maybe you just lost it Link to comment https://forums.phpfreaks.com/topic/11827-unzip-file-with-php/#findComment-45007 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.