|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71748 Opcache in CLI cannot be enabled
Submitted: 2016-03-09 00:24 UTC Modified: 2016-03-09 00:51 UTC
From: iquito at gmx dot net Assigned:
Status: Closed Package: opcache
PHP Version: 7.0.4 OS:
Private report: No CVE-ID: None
 [2016-03-09 00:24 UTC] iquito at gmx dot net
With PHP7, it makes sense to enable opcache for CLI together with the opcache.file_cache options. I tried the following options:


I found out that even though cron jobs worked fine, no files were cached. php CLI seems to completely ignore any opcache settings, and "phpinfo();" from command line also contains no opcache section. FPM correctly recognizes opcache settings and also displays them with phpinfo.

Test script:
Run php -d opcache.enable=1 inittest.php


echo ini_get('opcache.enable');


Another way to easily test it, is to run "<?php phpinfo();" from command line - no opcache section is contained in the output, no matter the php.ini settings.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-03-09 00:38 UTC] iquito at gmx dot net
I actually just "solved" it myself - php.ini needs a line with "" to enable opcache in CLI.

This is not the case with FPM - I compiled PHP myself, so including seems not to be necessary for FPM. But it is necessary for CLI. Maybe this is a possible configuration improvement for the PHP CLI compilation process?
 [2016-03-09 00:51 UTC] iquito at gmx dot net
-Status: Open +Status: Closed
 [2016-03-09 00:51 UTC] iquito at gmx dot net
I guess I just overlooked the zend_extension part - seems to be fine now.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 14 18:01:30 2024 UTC