Since the APC extension is no longer maintained and has been superseded, the code can simply rely on the apcu_*() functions.

The last stable APC version has been releases on May, 2011, five years and a half before this issue was open.
Hopefully, no Drupal 7 site is still running on PHP 5. They are more probably running on PHP 7 or 8, with the APCu extension.

Since the APCUIterator class is only available starting from version 5.0.0, the minimum APCu version needs to be raised to 5.0.0.

CommentFileSizeAuthor
#15 interdiff-8-6.txt19.39 KBavpaderno
#8 apcu-php7.patch11.83 KBqqboy
#6 2846622-apcu-php7.patch10.07 KBfgm

Issue fork apc-2846622

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

donquixote created an issue. See original summary.

A----’s picture

APCu for PHP7 (5.x) dropped the old APC compatibility.

You need to activate the apcu_bc (for Backward Compabitility.) That may or may not work, I did not try it.

Jorrit’s picture

Maybe the apc module can be change such that it doesn't need the backwards compatibility extension to be available.

fgm’s picture

You can just add this line above "// APCu reports cache ...."

    $apc_enabled = (function_exists('apcu_cache_info') && ($cache = @apcu_cache_info(TRUE)));

It won't make the module work, but you'll no longer see it in the requirements screen, if that's what you're looking for.

fgm’s picture

duplicate...

fgm’s picture

Title: apc_cache_info() not available in APCu PHP7? » Compatibility with APCu PHP7?
Status: Active » Needs review
StatusFileSize
new10.07 KB

Since I needed the plugin on PHP 7.0 without APCU-BC (Ubuntu Xenial 16.05 LTS), here is a port I did for the cache plugin.

I did not touch the requirements: the module doesn't need to be enabled to use the plugin anyway.

smitty’s picture

This patch works really fine!

qqboy’s picture

StatusFileSize
new11.83 KB

hi a patch based upon 2846622-apcu-php7.patch.

smitty’s picture

Hi qqboy, could you please report, what are the improvements of your patch compared to #6?

fgm’s picture

Maybe an interdiff ?

izus’s picture

FWIW
#2 makes it and worked well
installing php-apcu-bc makes it green again :)

Thanks

tjharman’s picture

I'm not sure if I'm posting to the right thread or if I should start a new one, but I can't get this to work with

Drupal 8.9.2 and 7.3.19-1~deb10u1

I have installed both modules:

[9:27:07] root :: micro  ➜  7.3/fpm/conf.d » dpkg -l | grep apc
ii  php-apcu                                                    5.1.17+4.0.11-1                                           amd64        APC User Cache for PHP
ii  php-apcu-bc                                                 1.0.4-4                                                   amd64        APCu Backwards Compatibility Module

I have restarted php-fpm.

Looking at phpinfo() I see:

APCu Support 	Enabled
Version 	5.1.17
APCu Debugging 	Disabled
MMAP Support 	Enabled
MMAP File Mask 	no value
Serialization Support 	php
Build Date 	Feb 8 2019 16:18:59
Directive	Local Value	Master Value
apc.coredump_unmap	Off	Off
apc.enable_cli	Off	Off
apc.enabled	On	On
apc.entries_hint	4096	4096

Still my Drupal Report tells me:

PHP APCu caching: Not enabled. PHP APCu caching can improve your site's performance considerably. It is highly recommended to have APCu installed on your server.

Do I have to add something to settings.php to get it to work?

avpaderno’s picture

Title: Compatibility with APCu PHP7? » Change the code that verify when APCu is available
Issue summary: View changes
avpaderno’s picture

Title: Change the code that verify when APCu is available » Make the module compatible with APCu
Issue summary: View changes
avpaderno’s picture

StatusFileSize
new19.39 KB
avpaderno’s picture

Assigned: Unassigned » avpaderno
avpaderno’s picture

Status: Needs review » Needs work

To make the module compatible with APCu, also the code in apc_requirements() must be changed. apc_requirements() cannot assume the APCu Backwards Compatibility Module extension is installed. That could be true most of the times, but it is not necessarily true.

avpaderno’s picture

Also, since the APC extension is no longer maintained and has been superseded, the code can simply rely on the apcu_*() functions.

The last stable APC version has been releases on May, 2011, five years and a half before this issue was open.
Hopefully, no Drupal 7 site is still running on PHP 5. They are more probably running on PHP 7 or 8, with the APCu extension.

avpaderno’s picture

Title: Make the module compatible with APCu » Change the module to require only the APCu extension
Issue summary: View changes
avpaderno’s picture

Issue summary: View changes

  • avpaderno committed c05fd1af on 7.x-1.x
    Issue #2846622:  Change the module to require only the APCu extension
    
avpaderno’s picture

Assigned: avpaderno » Unassigned
Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.