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
  • 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
IIS Cache Control settings 2 22
Redirect to HTTPS results in Infinite LOOP 4 134
Problem to open text file 11 128
C# LINQ ForEach() question 6 49
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
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.…

791 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