When trying to enable this module using Drush, I get this message:

Module apc doesn't meet the requirements to be enabled. The APC module needs the apc extension see: http://www.php.net/apc. (Currently using APC Not available)

If I enable it through the Modules page, I don't get any error message and APC shows up on the Status Report but the apc.php page doesn't show any entries being cached, except for apc.php. That might be too many problems for one issue, just wanted to give the full picture. I'm running a LAMP server, Ubuntu 12.04, PHP 5.3.10-1ubuntu3.1, APC 3.1.9.

Members fund testing for the Drupal project. Drupal Association Learn more



Status: Active » Closed (fixed)

I was able to get rid of the Drush message by adding apc.enable_cli=1 to my apc.ini file. After that I was able to enable the module via Drush. I still don't see any entries on my apc.php page, but that's unrelated to this issue.

Robin Millette’s picture

Category: support » task
Status: Closed (fixed) » Active

This little tidbit belongs in the README, no?

g10’s picture

#2 yes + mention that adding it to php.ini also work

MrHaroldA’s picture

Enabling APC on CLI seems a bit weird and unneeded.

IMHO it's better to put out a warning instead of error when trying to enable APC on a non-APC environment and display an error in the status page.

Phizes’s picture

As PHP currently stands, enabling apc caching for the command line is kind of pointless I think, the compiled files are lost from memory as soon as soon as the command line script stops executing, and it's a kludge for getting rid of an error message. Despite the error message being dealt with it still does not allow drush to clear the APC user cache, so it just hides the problem. I do think that you should be able to enable the module via Drush though instead of it refusing to do so.

As a side note, and mostly unrelated to this issue as it still wouldn't let drush clear the APC user cache:
There is some work being done on APC, Drush and the CLI as far as I recall which will enable the ability to store the byte code files in files so that they remain after the end of the script execution. It's over here

MrHaroldA’s picture

Version: 7.x-1.0-beta4 » 7.x-1.x-dev
Component: Miscellaneous » Code
Category: task » feature
Status: Active » Needs review
648 bytes

The attached patch puts out a warning instead of an error when enabling apc through Drush.

HypervisedEd’s picture

lrobeson's line to add apc.enable_cli=1 to /etc/php5/conf.d/apc.ini worked!

Here is a one liner for Ubuntu 12.04LTS that will add this line to end of this file....

printf "apc.enable_cli=1" >> /etc/php5/conf.d/apc.ini

Confirm by running:

cat /etc/php5/conf.d/apc.ini

MrHaroldA’s picture

@HypervisedEd APC should not be enabled on CLI. Totally useless since CLI isn't stateful.

MrHaroldA’s picture

One small addition to my comment above: you'll have to visit your Drupal site when you enable the APC module and cache in CLI mode, since the cache can't be cleared/rebuilt on CLI.

This should be fixed once #1565716: Make "drush cc" clear cache on the webnode itself is fixed.

R.Muilwijk’s picture

Status: Needs review » Needs work

Since alot of people use drush for enabling modules I think it's best if the module would actually be enabled but a message would be displayed you have to make changes to your settings.php.

MrHaroldA’s picture

This issue is about enabling the module using Drush. I suggest to add the reference to README.txt in this (reopened) issue: #1816606: Issue a warning in the status report if APC doesn't have any cache entries

twistor’s picture

Issue summary: View changes
Status: Needs work » Reviewed & tested by the community

As per #11. This seems good to go.

iamjon’s picture

I've tested #6 and the latest iteration of #10, I don't see how they are related because without #6 you can't enable the module with drush.
I think this patch should be committed.

R.Muilwijk’s picture

Status: Reviewed & tested by the community » Fixed

Committed on dev.

btopro’s picture

Status: Fixed » Reviewed & tested by the community

err.. where's the commit? I checked dev / beta6 and release notes and nothing mentioning this. It doesn't appear to be in any of the commit messages I cloned the repo and it's not there either

iamjon’s picture

you beat me to the post by 6 minutes.
I also checked and couldn't find it.

Update: I manually added the old patch

It no longer works because it tries to adjust the $requirements array which is now being created on line 37 from line 26.
So it attempts to change an array that has not been created yet. Updated patch coming.

iamjon’s picture

New Patch.

btopro’s picture

Status: Reviewed & tested by the community » Needs review
736 bytes

This got broken when APC started testing for APC vs APCu. This patch will fix this by giving you a message that you should know what you are doing when enabling via drush. We can't reliable detect version it would seem because of the memory partitioning issues expressed in other threads. Maybe this isn't the case but for now I'm rolling with this patch since it corrects the false negative that blocks all drush enabling commands if you are running PHP 5.3.3 / RHEL / anything pre-APC4.x.

iamjon’s picture

Status: Needs review » Reviewed & tested by the community

I test the patch against dev and it worked for me.
There's a typo it's reliably not reliable. "...but we cannot reliable detect this via drush" should be "...but we cannot reliably detect this via drush"

btopro’s picture

lol of course there's a typo, I wrote it. blarg

btopro’s picture

btopro’s picture

skip check for drush because it can't detect version number. Assumes that if you know drush you know what you're doing.