Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

First post here, so please do let me know if it should be elsewhere!

We have an issue right now in that our users have the ability to upload files via FTP. These are normally zip archives, and now and then there is a requirement to unzip them server-side.

We thought it would be a simple enough idea to create a basic form that would look at the file in the user's upload directory, extract the contents to a directory specified by the user, then report back on the outcome.

I have tested this code on a different server (Ubuntu Server 10.04) and it worked perfectly. On this particular server, (CentOS 5 I believe) the code generates an open_basedir error.

The reported error is as follows:

Error 1:

`Warning: ZipArchive::open() [ziparchive.open]: open_basedir restriction in effect. File(username/wallpapers.zip) is not within the allowed path(s): (/var/www/vhosts/mywebsite.com/subdomains/review/httpdocs:/tmp) in /var/www/vhosts/mywebsite.com/subdomains/review/httpdocs/unzip.php on line 11`

Error 2:

`file_exists() [function.file-exists]: open_basedir restriction in effect. File(user) is not within the allowed path(s): (/var/www/vhosts/mywebsite.com/subdomains/review/httpdocs:/tmp) in /var/www/vhosts/mywebsite.com/subdomains/review/httpdocs/unzip.php on line 16`

Thanks in advance for any input!


share|improve this question

1 Answer 1

It explains exactly what the issue is. open_basedir (http://php.net/manual/en/ini.core.php) is a directive which prohibits php from opening files outside of a certain location. It can create security issues if turned off - http://blog.php-security.org/archives/72-Open_basedir-confusion.html . You will need to make changes in the php.ini for this to work - presumably the two servers are configured differently.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.