The PHP running under apache and the CLI PHP are most probably reading different INI files, so the APCu module is loaded under the web server, but not in the CLI version. You need to chase down the INI files.