Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export database with zip compression: Class 'ZipArchive' not found error #14326

Closed
aswaniprakash opened this issue May 25, 2018 · 14 comments
Closed
Assignees
Labels
Bug A problem or regression with an existing feature
Projects
Milestone

Comments

@aswaniprakash
Copy link
Contributor

When trying to export a database with compression set to zipped, it shows the following error

PHP Fatal error: Uncaught Error: Class 'ZipArchive' not found in /var/www/html/phpmyadmin/libraries/classes/ZipExtension.php

@rijaspk
Copy link
Contributor

rijaspk commented May 29, 2018

Am getting some file not found error, like can't find the file http://localhost/phpmyadmin-test/export.php.

@ibennetch
Copy link
Member

ibennetch commented Jun 2, 2018

QA_4_8 and master are both affected by this

@ibennetch
Copy link
Member

Some notes for developers when fixing this:

For me, this is caused by the php zip extension not being loaded. We should handle this much more gracefully in all cases.

The ZipArchive class is used in libraries/classes/ZipExtension.php, which in turn is called in several places through the code - a robust solution will gracefully handle all these instances.

At least for the export interface, I thought it may be easiest to let the zip option listed in the dropdown list, but if the zip extension is not installed we should display an inline warning next to it saying the zip file type can't be used because of the missing extension.

@rijaspk
Copy link
Contributor

rijaspk commented Jun 6, 2018

@ibennetch, Along with displaying an inline warning should we abort the export?.

@ibennetch
Copy link
Member

@rijaspk yes, we shouldn't allow the user to submit the export form until they pick a different compression method.

@williamdes williamdes added the Bug A problem or regression with an existing feature label Nov 28, 2018
@williamdes
Copy link
Member

An example file (not a zip, edit with text editor)
192_168_12_1.sql (1).zip

Content

<br />
<font size='1'><table class='xdebug-error xe-uncaught-exception' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Fatal error: Uncaught Error: Class 'ZipArchive' not found in /mnt/Dev/phpmyadmintest/libraries/classes/ZipExtension.php on line <i>31</i></th></tr>
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Error: Class 'ZipArchive' not found in /mnt/Dev/phpmyadmintest/libraries/classes/ZipExtension.php on line <i>31</i></th></tr>
<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
<tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>
<tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0827</td><td bgcolor='#eeeeec' align='right'>459720</td><td bgcolor='#eeeeec'>{main}(  )</td><td title='/mnt/Dev/phpmyadmintest/export.php' bgcolor='#eeeeec'>.../export.php<b>:</b>0</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>2</td><td bgcolor='#eeeeec' align='center'>7.3096</td><td bgcolor='#eeeeec' align='right'>8945408</td><td bgcolor='#eeeeec'>PhpMyAdmin\Export->compress(  )</td><td title='/mnt/Dev/phpmyadmintest/export.php' bgcolor='#eeeeec'>.../export.php<b>:</b>608</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>3</td><td bgcolor='#eeeeec' align='center'>7.3348</td><td bgcolor='#eeeeec' align='right'>8946216</td><td bgcolor='#eeeeec'>PhpMyAdmin\ZipExtension->__construct(  )</td><td title='/mnt/Dev/phpmyadmintest/libraries/classes/Export.php' bgcolor='#eeeeec'>.../Export.php<b>:</b>424</td></tr>
</table></font>

@kartik1000
Copy link
Contributor

@williamdes, Hey is this issue still there? Because Zipped Compression for a database is working fine for me on Local Server. Or if I am missing something please let me know.
screenshot 2019-02-27 at 9 58 32 pm

@williamdes
Copy link
Member

@kartik1000 Remove php-zip extension :)
apt-get remove php7.3-zip

@ibennetch
Copy link
Member

I think the reason I thought we should continue to show the zip option in the menu is so as to not confuse users if it's missing, but with 10 months of time to think about it, I think it would be more consistent with our interface to not show it there at all.

@kartik1000
Copy link
Contributor

@ibennetch, don't you think that warning message would be most appropriate, in case of missing extension rather than simply removing it?

@williamdes
Copy link
Member

I agree with @kartik1000 !
Will will have people reporting this as an issue if we do not make it clear ..

@IlyaIndigo
Copy link

You do not need any impressions in the "Compression" with warning messages that it does not work.
Just in the "Compression" show "zip", if include the extension zip; and show "gzip" if include the extension "zlib".
Why is it so hard to do?

@ibennetch
Copy link
Member

ibennetch commented Apr 8, 2019 via email

@IlyaIndigo
Copy link

@ibennetch Sorry, If so then everything is fine.
Although I am "Compression" with the option "No", already hints about it.
Reading your correspondence, I thought that you want to leave everything as it is, just add messages that this type of compression does not work does not work.

@williamdes williamdes added this to High priority in issues Apr 29, 2019
@MauricioFauth MauricioFauth self-assigned this Aug 17, 2020
issues automation moved this from High priority to Closed Aug 17, 2020
@MauricioFauth MauricioFauth added this to the 5.0.3 milestone Aug 17, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A problem or regression with an existing feature
Projects
issues
  
Closed
Development

No branches or pull requests

7 participants