The class 'APCIterator' could not be found

09 Jul 2015 in TIL

This one catches me out every time, so documenting here for posterity.

Firstly, make sure apc or apcu (PHP 5.5+) is installed by running php -m | grep apc.

If you do have it installed but you're still getting the error The class 'APCIterator' could not be found. then you probably need to enable APC on the command line. Make sure the following lines exist in your php.ini file:

ini
apc.enabled = on
apc.enable_cli = on