The zip file is not valid

Article address issue with error that can occur when installing/adding plugin or theme into backoffice or directly via API from OsclassPoint market.

The zip file is not valid

The message indicates that the archive cannot be extracted, even though the plugin package itself is correct. The problem is related to how some server environments handle ZIP extraction rather than to the plugin file.

Why This Happens

Some hosting configurations have limitations or compatibility issues with PHP’s ZipArchive handling. As a result, the system fails to unpack certain archives uploaded through the installer, even though the same archive works normally outside the application.

Solution 1 — Re-zip the Plugin on Your Computer (Recommended)

Repacking the archive locally resolves the format mismatch in most cases.

Steps:

  1. Download the plugin ZIP file to your computer.

  2. Extract the ZIP file.

  3. Open the extracted folder and ensure it contains the plugin directory (not nested folders).

  4. Compress the plugin folder again using your operating system’s default compression tool:

    • Right-click the folder

    • Choose Send to → Compressed (ZIP) (Windows) or Compress (macOS)

  5. Upload this newly created ZIP file through the admin panel installer again.

This simple re-compression fixes the archive structure so the installer can process it correctly.

Solution 2 — Upload the Plugin Manually

If the installer still reports an error, you can install the plugin manually.

Steps:

  1. Extract the plugin ZIP file on your computer.

  2. Connect to your server using FTP or your hosting File Manager.

  3. Navigate to: oc-content/plugins

  1. Upload the extracted plugin folder there.

  2. Log in to the admin panel.

  3. Go to Plugins and activate the plugin.

Manual upload bypasses the ZIP extraction process completely.

Alternative Fix — Update Core Extraction Method

If the issue occurs repeatedly, you can adjust the extraction method used by the system. This is a one-time change that improves compatibility with certain server environments.

  1. Open the following file on your server:
oc-includes/osclass/utils.php
  1. Find the function:
function _unzip_file_ziparchive($file, $to) {
  1. Inside this function, locate the line:
$zipopen = $zip->open($file, ZipArchive::OVERWRITE);
  1. Replace it with:
$zipopen = $zip->open($file, ZipArchive::CREATE);

This change modifies how ZIP archives are opened and prevents extraction failures caused by overwrite mode on some hosting configurations.

Save the file and try installing the plugin again.

When to Use Each Method

  • Re-zipping is the fastest fix and works in most cases.

  • Manual upload is ideal when installer access is limited or unreliable.

  • Updating the extraction method is useful if you frequently install plugins and want a permanent solution.

Additional Notes

  • Always ensure the uploaded ZIP contains the plugin folder directly, not another ZIP inside it.

  • After manual installation, verify folder permissions allow reading by the web server.

  • If the plugin appears in the list but cannot be activated, recheck the folder structure.

 

Following one of the methods above should allow the plugin to install and activate without further errors.