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‐multisite instance “sees” the ZipArchive extension but another doesn’t, it almost always comes down to one of two things:
-
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. -
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 tosites/default, whose settings (including temp paths or overrides) may not be what you’ve configured.
1. Verify which PHP is in play
-
In the document root of the problem site, drop in a small
info.php:php
CopyEdit
<?php phpinfo(); -
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
.inifiles) -
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', );
-
Open
sites/sites.php. -
Make sure your failing domain is pointed at the directory whose settings you’ve already configured to use zip.
-
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
-
Which PHP ini?
Drop aphpinfo()file into the problem site, see which php.ini and/or .user.ini it’s loading. Edit that file to enableextension=zip. -
Which Backdrop folder?
Opensites/sites.phpand confirm your domain is mapped to the folder you expect (notsites/default). -
Temp-dir writable?
In that site’ssettings.php, setsystem.file.temporary_pathto 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.