I'll update my answer to demonstrate. What if you don't have the ZipArchive class available? I'm working on a site with crap hosting and I get the Fatal error: Class 'ZipArchive' not found error which I try this script :- Is there any option at that point?
Even to make system calls you'd need to have the underlying library. This is a very ubiquitous thing though, and not having it is the exception. If you're on shared hosting, they should install it for you. Yeah, it's pretty cheap hosting as I've been told. Anyway, thanks for the reply, it's good stuff to know.
Show 1 more comment. Aleksandar Vucetic Aleksandar Vucetic Rubyx Rubyx 10 10 silver badges 29 29 bronze badges. Morteza Ziyae Morteza Ziyae 1, 4 4 gold badges 27 27 silver badges 46 46 bronze badges. Be really careful when dealing with system or exec functions which contains variables! It can litteraly give a free command line from your server to a hacker. Back your claims with facts — Samuel Kwame Antwi.
SamuelKwameAntwi exec and system are calling the system shell, with the php user. So, if your user is www, you can do all what unix user "www" can do on the command line, including the removing of files or directories. It's really worst if your php user is root. You can find more info about it there: stackoverflow. Simple PHP function to unzip. Please make sure you have zip extension installed on your server. Community Bot 1 1 1 silver badge.
Change Language. Related Articles. Table of Contents. Improve Article. Save Article. Like Article. File dowloaded after successful execution. Downloaded image file. Learn more. PHP download and extract zip file Ask Question. Asked 6 years, 10 months ago. Active 2 years, 10 months ago. Viewed 9k times. If that makes sense. Lee Lee 1, 1 1 gold badge 18 18 silver badges 38 38 bronze badges. Each instruction in a PHP script executes till it has completed, and only then does it move on to executing the next instruction — Mark Baker.
Thanks for that Mark! Add a comment. Active Oldest Votes. Now we come to our second part that is extract the downloaded zip file we create a new zip archive object then simply use open function to open zip file and extract the zip file to a particular folder by using extractTo function. You can also view create, edit and delete file using PHP.
0コメント