Project

General

Profile

Actions

Bug #82621

closed

The APCu backend cannot be used because apcu is disabled on CLI.

Added by Remo H. about 7 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
CLI
Target version:
-
Start date:
2017-09-29
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Uncaught TYPO3 Exception #1232985915: The APCu backend cannot be used because apcu is disabled on CLI.
thrown in file /home/alcosuis/public_html/staging2.alcosuisse.ch/typo3_src-8.7.6/typo3/sysext/core/Classes/Cache/Backend/ApcuBackend.php
in line 84

If it is not possible to use it, the system should fallback to database for CLI.
Change the configuration in install tool is not the best solution...


Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Task #78140: Disable APCu on CLI, if it was added to LocalConfiguration.php automatically while installing TYPO3 New2016-10-04

Actions
Actions #1

Updated by Mathias Schreiber about 7 years ago

Out of curiosity: Why did you configure APCu for TYPO3 and did not enable it for CLI?
A fallback makes little to no sense, if you want to warm up caches via CLI that are then not used in the frontend.

I seem to miss something here, please try to describe your usecase in a bit more detail.

Actions #2

Updated by Remo H. about 7 years ago

You're right. It's probably not an issue of TYPO3.
Checking with Hoster for PHP settings...
Can probably be closed.
Thanks for the quick response.

Actions #3

Updated by Mathias Schreiber about 7 years ago

  • Status changed from New to Resolved

Ok, glad I could help.
I will close the issue now, if we need to re-open it, don't hesitate to comment here or hit me up on Slack.
Enjoy the weekend :)

Actions #4

Updated by Oliver Hader about 7 years ago

Side-note: Fresh TYPO3 installations will use APCu if it's available for the web-context (see ApcuPreset), and PHP 7.1 (at least on Ubuntu 17.10) does not enable the according flag in PHP-CLI per default.

Work-around (example for Ubuntu 17.10):
Modify /etc/php/7.1/cli/conf.d/20-apcu.ini
Add apc.enable_cli=on

Actions #5

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions #6

Updated by Dirk Wenzel almost 6 years ago

IMHO this issue is not solved and it is a TYPO3 issue:

  • if APCu is available it is recommend as Extbase-Object-Cache in the Installtool in the Configuration Presets
  • the constructor of `TYPO3\CMS\Core\Cache\Backend\ApcuBackend` throws an Execption if `PHP_SAPI === 'cli' && ini_get('apc.enable_cli') == 0` allthough
  • the documentation for `apc.enable_cli` [1] says
    Mostly for testing and debugging. Setting this enables APC for the CLI version of PHP. 
    Under normal circumstances, it is not ideal to create, populate and destroy the APC cache on every CLI request,
    but for various test scenarios it is useful to be able to enable APC for the CLI version of PHP easily. 
    
  • if enabled for the CLI, APCu will most probably have no positive effect since the cache is created, populated AND destroyed for each call (and not re-used later on)
My conclusion is TYPO3 should :
  • silently ignore the APCu-cache in CLI (use NullBackend instead)
  • optionally log a message

see https://forge.typo3.org/issues/78140

[1] http://php.net/manual/en/apc.configuration.php#ini.apc.enable-cli

Actions #7

Updated by Felix Nagel almost 5 years ago

I agree with Dirk Wenzel. Most hosters do not allow APCu on CLI.

Actions #8

Updated by Benni Mack over 4 years ago

  • Related to Task #78140: Disable APCu on CLI, if it was added to LocalConfiguration.php automatically while installing TYPO3 added
Actions #9

Updated by Sascha no-lastname-given over 3 years ago

My workaround is to change the following to AdditionalConfiguration.php

if (php_sapi_name() == 'cli') {
    /** @var ConfigurationManager $configurationManager */
    $configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class);
    $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching'] = $configurationManager->getDefaultConfiguration()['SYS']['caching'];
}

Actions

Also available in: Atom PDF