PHP unzip on IIS7 Windows server

Posted on 2013-11-14
Last Modified: 2013-11-20

I am trying to unzip a .zip file on a server with the following PHP script

$zip = new ZipArchive;
if ($zip->open('') === TRUE) {
    echo 'ok';
} else {
    echo 'failed';

Open in new window

The code segment is generating the following error:

Parse error: syntax error, unexpected T_OBJECT_OPERATOR in test-unzip.php on line 4

I suspect this may be linux code and must be altered for a window server...

Any thoughts?
Question by:RustyRazor
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
LVL 27

Expert Comment

by:Lukasz Chmielewski
ID: 39648882
What is your PHP version ? Isn't it 4.x ?

Author Comment

ID: 39649117
PHP v5.3 under IIS7

Accepted Solution

RustyRazor earned 0 total points
ID: 39652524
This works (must specify absolute Windows path)


$zip = new ZipArchive;
if ($zip->open($sourceFileName) === TRUE) {
    echo 'ok';
} else {
    echo 'failed';

Author Closing Comment

ID: 39662087
nobody else solved it

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question