[support] ZipArchive is not working

Swatee Karpe swateekarpe at gmail.com
Tue Jan 28 07:58:20 UTC 2014


Yes Jamie,

I think its some security/permission issue in my case..

Thanks a lot for your inputs.


On Tue, Jan 28, 2014 at 12:19 PM, Jamie Holly <hovercrafter at earthlink.net>wrote:

>  You might need an absolute path on that. Try:
>
> DRUPAL_ROOT . '/sites/samplesite.com/files/newsletters/';
>
> Outside of that, I'm really not sure. There's a chance it could be
> something in Ubuntu's security. I know they do some hardening on PHP and
> Apache by default, but can't really remember exactly what it is (I'm a RHEL
> guy).
>
> Jamie Hollyhttp://hollyit.net
>
> On 1/27/2014 11:04 PM, Swatee Karpe wrote:
>
> yes jamie, is same folder .
> so my folder is
> /sites/samplesite.com/files/newsletters/
>
>  and permission is
> drwxrwxrwx 2 ubuntu ubuntu    4096 Jan 28 03:18 newsletters
>
>
>  but still i get the error
>
>  "Warning: ZipArchive::extractTo(): Permission denied in
> ArchiverZip->extract() (line 112 of
> samplesite.com/modules/system/system.archiver.inc)"
>
>  I tried with www-data as owner user for above directory(
> http://stackoverflow.com/questions/12446583/php-warning-ziparchiveextractto-permission-denied),
> but still it wont work. it shows same error, as permission denied.
>
>  Please if u have any idea, help me in this.
>
>
>  thanks a lot for your help so far.
>
>
>
>
>
>
> On Tue, Jan 28, 2014 at 11:55 AM, Jamie Holly <hovercrafter at earthlink.net>wrote:
>
>>  You showed the permissions for files/test. Is that folder the same?
>>
>> Jamie Hollyhttp://hollyit.net
>>
>>   On 1/27/2014 10:43 PM, Swatee Karpe wrote:
>>
>> /sites/samplesite.com/files/newsletters/
>>
>>
>> On Tue, Jan 28, 2014 at 11:35 AM, Jamie Holly <hovercrafter at earthlink.net
>> > wrote:
>>
>>>  What's the path your are sending to extract to?
>>>
>>> Jamie Hollyhttp://hollyit.net
>>>
>>>   On 1/27/2014 10:25 PM, Swatee Karpe wrote:
>>>
>>> Jamie,
>>>
>>>  Now I can see Warning: ZipArchive::extractTo(): Permission denied in
>>> ArchiverZip->extract() (line 112 of
>>> /examplesite/modules/system/system.archiver.inc) error.
>>>
>>>  My files/test have following permission
>>>
>>>  drwxrwxrwx 2 ubuntu ubuntu    4096 Jan 28 03:18 test
>>>
>>>  I cant understand why this error occur.
>>>
>>>  Any idea on this?
>>>
>>>
>>>
>>>
>>>
>>>
>>>  On Tue, Jan 28, 2014 at 11:15 AM, Swatee Karpe <swateekarpe at gmail.com>wrote:
>>>
>>>> $file = public://archive.zip. like this.
>>>>
>>>>
>>>> On Tue, Jan 28, 2014 at 11:08 AM, Jamie Holly <
>>>> hovercrafter at earthlink.net> wrote:
>>>>
>>>>>  What are you using to set the $file variable? It needs to be a path
>>>>> to the local file system. What you got is a URL. You want something more
>>>>> along the lines of /sites/samplesite.com/files/testjan.zip
>>>>>
>>>>> Jamie Hollyhttp://hollyit.net
>>>>>
>>>>>   On 1/27/2014 9:54 PM, Swatee Karpe wrote:
>>>>>
>>>>> Thanks for replying Jamie.
>>>>>
>>>>>  I tried to use $archiver = archiver_get_archiver($file);
>>>>>
>>>>>  It shows *Exception*: Archivers can only operate on local files: <em
>>>>> class="placeholder">
>>>>> http://samplesite.com/sites/samplesite.com/files/testjan.zip</em> not
>>>>> supported in *archiver_get_archiver()* (line *8091* of
>>>>> */sites/drupal7/includes/common.inc*).
>>>>> Error to me.
>>>>>
>>>>>  Any solution on this?
>>>>>
>>>>>  do u have sample code for this?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Mon, Jan 27, 2014 at 10:02 PM, Jamie Holly <
>>>>> hovercrafter at earthlink.net> wrote:
>>>>>
>>>>>>  If you're using Drupal 7, it would be better to use the built in
>>>>>> archiver class. It's used in update_manager_archive_extract in
>>>>>> modules/update/update.manager.inc:
>>>>>>
>>>>>>
>>>>>> https://api.drupal.org/api/drupal/modules%21update%21update.manager.inc/function/update_manager_archive_extract/7
>>>>>>
>>>>>>
>>>>>> Jamie Hollyhttp://hollyit.net
>>>>>>
>>>>>>   On 1/27/2014 2:20 AM, Swatee Karpe wrote:
>>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>>  I am using drupal 7 and I want extract the zip file and save the
>>>>>> extracted folder into files directory. I am taking zip file from one of my
>>>>>> content type.
>>>>>>
>>>>>>  For this I am trying to use ZipArchive class.
>>>>>>
>>>>>>  $zip = new ZipArchive;
>>>>>>
>>>>>>   $unzip = $zip->open($filename);
>>>>>>
>>>>>>  ZipArchive Object
>>>>>> (
>>>>>>     [status] => 0
>>>>>>     [statusSys] => 0
>>>>>>     [numFiles] => 0
>>>>>>     [filename] =>
>>>>>>     [comment] =>
>>>>>>
>>>>>> )
>>>>>>
>>>>>>  After printing $zip i get the empty array as above.
>>>>>>
>>>>>>  Do any one know why this is not working in my case?
>>>>>> Or any one know other way to extract file and save it to folder.
>>>>>>
>>>>>>  Thanks in advance.
>>>>>> --
>>>>>> Swatee Amit Karpe
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> [ Drupal support list | http://lists.drupal.org/ ]
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>  --
>>>>> Thanks & Regards,
>>>>> Swatee Amit Karpe
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> [ Drupal support list | http://lists.drupal.org/ ]
>>>>>
>>>>
>>>>
>>>>
>>>>  --
>>>> Thanks & Regards,
>>>> Swatee Amit Karpe
>>>>
>>>>
>>>
>>>
>>>  --
>>> Thanks & Regards,
>>> Swatee Amit Karpe
>>>
>>>
>>>
>>>
>>>
>>> --
>>> [ Drupal support list | http://lists.drupal.org/ ]
>>>
>>
>>
>>
>>  --
>> Thanks & Regards,
>> Swatee Amit Karpe
>>
>>
>>
>>
>>
>> --
>> [ Drupal support list | http://lists.drupal.org/ ]
>>
>
>
>
>  --
> Thanks & Regards,
> Swatee Amit Karpe
>
>
>
>
>
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>



-- 
Thanks & Regards,
Swatee Amit Karpe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20140128/b03f9355/attachment-0001.html 


More information about the support mailing list