Plugins can´t be installed

We have installed OJS (3.2.1.0) and have observed problems when trying to install plugins from Plugin Gallery. In all cases, the popup notification indicates The tar command is not available. Please correctly configure it in your “config.inc.php”…

Hello @Fernando_Campos_Casa.

This error message usually means that the path to the tar command in the config.inc.php is incorrect. Please make sure that it is configured properly in config.inc.php - if it looks correct and you are still getting an error message, please show us your tar config and hopefully someone can help.

Good Morning,

I write in this post because I read about a problem similar to the one I have with the tar command

The OJS is 3.1.2.4 and in “config.inc.php” the tar configuration is

"; tar (used in backup plugin, translation packaging)
tar = / bin / tar "

In the system information I see that route

Tar OJS Info

In the PHP information (Version 7.2.34) it is enabled

TAR PHP

In the SSH it shows that the path is / bin / tar / and the server administrator tells me that it is that path.

The server works with Linux

Datos servidor OJS

Does anyone know how to solve it? Is there another 3x version that doesn’t have this problem?

Thanks

Apparently some server configurations prevent the following test in lib/pkp/classes/plugins/PluginHelper.inc.php to succeed (tested on OJS 3.2.1.4, but see this part in 3.3.0.10 too):

// Test whether the tar binary is available for the export to work
		$tarBinary = Config::getVar('cli', 'tar');
		if (empty($tarBinary) || !file_exists($tarBinary)) {
			rmdir($pluginExtractDir);
			throw new Exception(__('manager.plugins.tarCommandNotFound'));
		}

even though the tar command is available and working.

After commenting the whole “if” statement above I could install a new plugin/theme.

According to my server provider this test won’t be allowed due to security measures, so maybe this issue could be addressed somehow?

Hi @piotreba,

Is it specifically the !file_exists($tarBinary) part of the test that breaks? Do you know what mechanism they’re using to intervene in that test?

Regards,
Alec Smecher
Public Knowledge Project Team

@asmecher, I tested this and indeed, only the “!file_exists($tarBinary)” part of the condition seems to be problematic, not the “empty($tarBinary)” one.

Hi @piotreba,

Can you find out the mechanism they’re using to prevent file_exists from working as expected? For example, are they using open_basedir restrictions?

Regards,
Alec Smecher
Public Knowledge Project Team

I will, and will come back here.

@asmecher, I confirm that file_exists condition failure results from open_basedir restrictions.

Hi @piotreba,

Ah, I understand. This leads to the unusual circumstance that PHP reports that /bin/tar does not exist, but system can execute it. I view this is a hole in the open_basedir set of options in PHP; in my opinion it’s pointless to enable this while system is usable.

However, rather than changing this interaction directly, there is another proposed change that will moot the discrepancy:

I’d suggest maintaining your local modification to that test, and when the above issue is implemented, your change can be reverted.

Regards,
Alec Smecher
Public Knowledge Project Team

Thanks @asmecher. Will test this in subsequent updates.

1 Like