Bug #71748 [Opn]: Opcache in CLI cannot be enabled
| From: | iquito at gmx dot net | Date: | Wed, 09 Mar 2016 00:38:17 +0000 |
| Subject: | Bug #71748 [Opn]: Opcache in CLI cannot be enabled | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-199682@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71748&edit=1
ID: 71748
User updated by: iquito at gmx dot net
Reported by: iquito at gmx dot net
Summary: Opcache in CLI cannot be enabled
Status: Open
Type: Bug
Package: opcache
PHP Version: 7.0.4
Block user comment: N
Private report: N
New Comment:
I actually just "solved" it myself - php.ini needs a line with
"zend_extension=opcache.so" to enable opcache in CLI.
This is not the case with FPM - I compiled PHP myself, so including opcache.so 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?
Previous Comments:
------------------------------------------------------------------------
[2016-03-09 00:24:47] iquito at gmx dot net
Description:
------------
With PHP7, it makes sense to enable opcache for CLI together with the opcache.file_cache options. I
tried the following options:
opcache.enable=1
opcache.enable_cli=1
opcache.file_cache="/srv/php-file-cache"
opcache.file_cache_only=0
opcache.file_cache_consistency_checks=1
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
inittest.php:
<?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.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71748&edit=1