You said:

I have a set of websites running in a multi-site configuration in Backdrop CMS. One site runs and decodes zip files normally but another site will not unpack a zip file and seems not to recognise tat the PHP zip extension is activated. What would cause this? What file should I look to change?

ChatGPT said:

Thought for 20 seconds

When one Backdrop‐multi­site instance “sees” the ZipArchive extension but another doesn’t, it almost always comes down to one of two things:

  1. You’re not actually loading the same PHP configuration

    Even though you believe ZIP is enabled, the “broken” site may be using a different php.ini (or a per-directory override) that never loaded the extension.

  2. You’re not bootstrapping the same site directory

    If Backdrop can’t match your domain to the folder you think it is, it will fall back to sites/default, whose settings (including temp paths or overrides) may not be what you’ve configured.

1. Verify which PHP is in play

  1. In the document root of the problem site, drop in a small info.php:

    php

    CopyEdit

    <?php phpinfo();

  2. Browse to it (e.g. https://yoursite.com/info.php) and check:

    • Loaded Configuration File (the php.ini that’s actually in use)

    • *Scan this dir for additional .ini (any per-directory .ini files)

    • Under “Modules” → “zip” – is it listed?

If you don’t see ZIP there, then you need to edit whichever php.ini that site is loading (or remove/adjust its per-directory .user.ini or .htaccess that might disable it).

Tip: On many shared hosts or php-fpm setups you’ll see a “.user.ini” in your webroot; that file can override extension= directives.

2. Ensure Backdrop is bootstrapping the right site folder

Backdrop’s multi-site logic lives in sites/sites.php (in your project’s root). That file maps hostnames to subdirectories. If your “problem” domain isn’t listed, Backdrop will drop back to sites/default:

php

CopyEdit

<?php /** * @file * Hosts may be mapped to site directories here. */ $sites = array( 'example.com' => 'example.com', 'www.example.com' => 'example.com', 'sub.domain.tld' => 'sub.domain.tld', );

  1. Open sites/sites.php.

  2. Make sure your failing domain is pointed at the directory whose settings you’ve already configured to use zip.

  3. If you omitted the www. or added it inconsistently, Backdrop will route you to the wrong folder.

3. Double-check your site’s settings.php temp path

Once you’re sure you’re loading the correct folder, open:

bash

CopyEdit

sites/your-site-folder/settings.php

Look for (or add) a line like:

php

CopyEdit

// ensure Backdrop can extract archives $config['system.file']['temporary_path'] = '/full/server/path/to/sites/your-site-folder/tmp';

Make sure that directory exists and is writable by the web server. If Backdrop can’t write into “tmp,” ZipArchive extracts will silently fail.

In summary

  1. Which PHP ini?

    Drop a phpinfo() file into the problem site, see which php.ini and/or .user.ini it’s loading. Edit that file to enable extension=zip.

  2. Which Backdrop folder?

    Open sites/sites.php and confirm your domain is mapped to the folder you expect (not sites/default).

  3. Temp-dir writable?

    In that site’s settings.php, set system.file.temporary_path to a real, writable directory.

Once you’ve aligned those three pieces, clear Backdrop’s cache (/admin/config/development/performance) and try your unzip again.

 

Tools

ChatGPT can make mistakes. Check important info.